]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-133210: Fix `test_inspect` without docstrings (GH-139651) (#139670)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 6 Oct 2025 17:13:08 +0000 (19:13 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Oct 2025 17:13:08 +0000 (17:13 +0000)
gh-133210: Fix `test_inspect` without docstrings (GH-139651)
(cherry picked from commit 7c70cc5c23971ef448ea59827c6e6ae310157356)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_inspect/test_inspect.py

index 3e73dc5fe2694c4a43e67561684c3e1d3a5b31eb..691c2ffd5cc1db8e347fb1f9795a8b04f2213b53 100644 (file)
@@ -4385,8 +4385,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'):