Skip to content

Commit f177f6f

Browse files
gh-96478: Test @overload on C functions (#96479)
Co-authored-by: Alex Waygood <[email protected]>
1 parent 30878a7 commit f177f6f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_typing.py

+14
Original file line numberDiff line numberDiff line change
@@ -4391,6 +4391,20 @@ def blah():
43914391

43924392
blah()
43934393

4394+
@patch("typing._overload_registry",
4395+
defaultdict(lambda: defaultdict(dict)))
4396+
def test_overload_on_compiled_functions(self):
4397+
# The registry starts out empty:
4398+
self.assertEqual(typing._overload_registry, {})
4399+
4400+
# This should just not fail:
4401+
overload(sum)
4402+
overload(print)
4403+
4404+
# No overloads are recorded (but, it still has a side-effect):
4405+
self.assertEqual(typing.get_overloads(sum), [])
4406+
self.assertEqual(typing.get_overloads(print), [])
4407+
43944408
def set_up_overloads(self):
43954409
def blah():
43964410
pass

0 commit comments

Comments
 (0)