summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_inspect
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-06-27 11:47:20 (GMT)
committerGitHub <noreply@github.com>2024-06-27 11:47:20 (GMT)
commitdb96edd6d1a58045196a71aff565743f493b5fbb (patch)
treeeea2596651c3e0b059363e014624eafd28ad5896 /Lib/test/test_inspect
parent223c03a43c010cf4404f2a42efafe587646a0619 (diff)
downloadcpython-db96edd6d1a58045196a71aff565743f493b5fbb.zip
cpython-db96edd6d1a58045196a71aff565743f493b5fbb.tar.gz
cpython-db96edd6d1a58045196a71aff565743f493b5fbb.tar.bz2
gh-121027: Add a future warning in functools.partial.__get__ (#121086)
Diffstat (limited to 'Lib/test/test_inspect')
-rw-r--r--Lib/test/test_inspect/test_inspect.py31
1 files changed, 19 insertions, 12 deletions
diff --git a/Lib/test/test_inspect/test_inspect.py b/Lib/test/test_inspect/test_inspect.py
index 1ade4bb..308c098 100644
--- a/Lib/test/test_inspect/test_inspect.py
+++ b/Lib/test/test_inspect/test_inspect.py
@@ -3873,10 +3873,12 @@ class TestSignatureObject(unittest.TestCase):
def __init__(self, b):
pass
- self.assertEqual(C(1), (2, 1))
- self.assertEqual(self.signature(C),
- ((('a', ..., ..., "positional_or_keyword"),),
- ...))
+ with self.assertWarns(FutureWarning):
+ self.assertEqual(C(1), (2, 1))
+ with self.assertWarns(FutureWarning):
+ self.assertEqual(self.signature(C),
+ ((('a', ..., ..., "positional_or_keyword"),),
+ ...))
with self.subTest('partialmethod'):
class CM(type):
@@ -4024,10 +4026,12 @@ class TestSignatureObject(unittest.TestCase):
class C:
__init__ = functools.partial(lambda x, a: None, 2)
- C(1) # does not raise
- self.assertEqual(self.signature(C),
- ((('a', ..., ..., "positional_or_keyword"),),
- ...))
+ with self.assertWarns(FutureWarning):
+ C(1) # does not raise
+ with self.assertWarns(FutureWarning):
+ self.assertEqual(self.signature(C),
+ ((('a', ..., ..., "positional_or_keyword"),),
+ ...))
with self.subTest('partialmethod'):
class C:
@@ -4282,10 +4286,13 @@ class TestSignatureObject(unittest.TestCase):
class C:
__call__ = functools.partial(lambda x, a: (x, a), 2)
- self.assertEqual(C()(1), (2, 1))
- self.assertEqual(self.signature(C()),
- ((('a', ..., ..., "positional_or_keyword"),),
- ...))
+ c = C()
+ with self.assertWarns(FutureWarning):
+ self.assertEqual(c(1), (2, 1))
+ with self.assertWarns(FutureWarning):
+ self.assertEqual(self.signature(c),
+ ((('a', ..., ..., "positional_or_keyword"),),
+ ...))
with self.subTest('partialmethod'):
class C: