mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
gh-121027: Add a future warning in functools.partial.__get__ (#121086)
This commit is contained in:
parent
223c03a43c
commit
db96edd6d1
7 changed files with 75 additions and 17 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue