]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-133210: Fix `test_inspect` without docstrings (#139651)
authorsobolevn <mail@sobolevn.me>
Mon, 6 Oct 2025 16:48:50 +0000 (19:48 +0300)
committerGitHub <noreply@github.com>
Mon, 6 Oct 2025 16:48:50 +0000 (19:48 +0300)
Lib/test/test_inspect/test_inspect.py

index 555efb78dcc6aabd30bf0785e2b312e02e63b2aa..e32e34c63b53246f86832924eadeeb6cb28962cb 100644 (file)
@@ -4261,8 +4261,14 @@ class TestSignatureObject(unittest.TestCase):
 
             self.assertEqual(self.signature(C, follow_wrapped=False),
                              varargs_signature)
-            self.assertEqual(self.signature(C.__new__, follow_wrapped=False),
-                             varargs_signature)
+            if support.MISSING_C_DOCSTRINGS:
+                self.assertRaisesRegex(
+                    ValueError, "no signature found",
+                    self.signature, C.__new__, follow_wrapped=False,
+                )
+            else:
+                self.assertEqual(self.signature(C.__new__, follow_wrapped=False),
+                                varargs_signature)
 
     def test_signature_on_class_with_wrapped_new(self):
         with self.subTest('FunctionType'):