diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2014-01-28 00:29:45 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2014-01-28 00:29:45 (GMT) |
commit | e7dcc5e97a0a9cc7b90d4da72a4d9c69f49aac3c (patch) | |
tree | 2d6f59416481aa44d7bcd1f642d0e0a3087d4d44 /Lib/test | |
parent | 7aedea40d66a628236cba60f0d2712daf5e68198 (diff) | |
download | cpython-e7dcc5e97a0a9cc7b90d4da72a4d9c69f49aac3c.zip cpython-e7dcc5e97a0a9cc7b90d4da72a4d9c69f49aac3c.tar.gz cpython-e7dcc5e97a0a9cc7b90d4da72a4d9c69f49aac3c.tar.bz2 |
inspect.signature: Support classes without user-defined __init__/__new__ #20308
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_inspect.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index f5f18f0..a6b4c7a 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -2045,6 +2045,20 @@ class TestSignatureObject(unittest.TestCase): ('bar', 2, ..., "keyword_only")), ...)) + # Test classes without user-defined __init__ or __new__ + class C: pass + self.assertEqual(str(inspect.signature(C)), '()') + class D(C): pass + self.assertEqual(str(inspect.signature(D)), '()') + + # Test meta-classes without user-defined __init__ or __new__ + class C(type): pass + self.assertEqual(str(inspect.signature(C)), + '(object_or_name, bases, dict)') + class D(C): pass + self.assertEqual(str(inspect.signature(D)), + '(object_or_name, bases, dict)') + def test_signature_on_callable_objects(self): class Foo: def __call__(self, a): |