Skip to content

Commit 378a96e

Browse files
[3.12] gh-112001: Fix test_builtins_have_signatures in test_inspect (GH-112002) (GH-112003)
(cherry picked from commit 40752c1) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 158a7e1 commit 378a96e

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

Lib/test/test_inspect/test_inspect.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4516,19 +4516,14 @@ def test_builtins_have_signatures(self):
45164516
# These have unrepresentable parameter default values of NULL
45174517
needs_null = {"anext"}
45184518
no_signature |= needs_null
4519-
# These need PEP 457 groups or a signature change to accept None
4520-
needs_semantic_update = {"round"}
4521-
no_signature |= needs_semantic_update
45224519
# These need *args support in Argument Clinic
4523-
needs_varargs = {"breakpoint", "min", "max", "print",
4524-
"__build_class__"}
4520+
needs_varargs = {"breakpoint", "min", "max", "__build_class__"}
45254521
no_signature |= needs_varargs
4526-
# These simply weren't covered in the initial AC conversion
4527-
# for builtin callables
4528-
not_converted_yet = {"open", "__import__"}
4529-
no_signature |= not_converted_yet
45304522
# These builtin types are expected to provide introspection info
4531-
types_with_signatures = set()
4523+
types_with_signatures = {
4524+
'complex', 'enumerate', 'float', 'list', 'memoryview', 'object',
4525+
'property', 'reversed', 'tuple',
4526+
}
45324527
# Check the signatures we expect to be there
45334528
ns = vars(builtins)
45344529
for name, obj in sorted(ns.items()):
@@ -4547,9 +4542,9 @@ def test_builtins_have_signatures(self):
45474542
# This ensures this test will start failing as more signatures are
45484543
# added, so the affected items can be moved into the scope of the
45494544
# regression test above
4550-
for name in no_signature:
4545+
for name in no_signature - needs_null - needs_groups:
45514546
with self.subTest(builtin=name):
4552-
self.assertIsNone(obj.__text_signature__)
4547+
self.assertIsNone(ns[name].__text_signature__)
45534548

45544549
def test_python_function_override_signature(self):
45554550
def func(*args, **kwargs):

0 commit comments

Comments
 (0)