diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2022-06-21 19:45:38 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-21 19:45:38 (GMT) |
commit | 4e08fbcfdfa57ea94091aabdd09413708e3fb2bf (patch) | |
tree | c0f7fcee354ead27cbdbc69c19954555585e013c /Lib/test | |
parent | dd5cf84f245abf84405833320b8f25dbc43b24d2 (diff) | |
download | cpython-4e08fbcfdfa57ea94091aabdd09413708e3fb2bf.zip cpython-4e08fbcfdfa57ea94091aabdd09413708e3fb2bf.tar.gz cpython-4e08fbcfdfa57ea94091aabdd09413708e3fb2bf.tar.bz2 |
gh-93021: Fix __text_signature__ for __get__ (GH-93023)
Because of the way wrap_descr_get is written, the second argument
to __get__ methods implemented through the wrapper is always
optional.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_types.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index cde9dad..8556ca3 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -597,6 +597,12 @@ class TypesTests(unittest.TestCase): self.assertIsInstance(object.__lt__, types.WrapperDescriptorType) self.assertIsInstance(int.__lt__, types.WrapperDescriptorType) + def test_dunder_get_signature(self): + sig = inspect.signature(object.__init__.__get__) + self.assertEqual(list(sig.parameters), ["instance", "owner"]) + # gh-93021: Second parameter is optional + self.assertIs(sig.parameters["owner"].default, None) + def test_method_wrapper_types(self): self.assertIsInstance(object().__init__, types.MethodWrapperType) self.assertIsInstance(object().__str__, types.MethodWrapperType) |