8000 gh-96478: Test `@overload` on C functions · python/cpython@189797f · GitHub
[go: up one dir, main page]

Skip to content

Commit 189797f

Browse files
committed
gh-96478: Test @overload on C functions
1 parent 894cafd commit 189797f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Lib/test/test_typing.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4391,6 +4391,21 @@ 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+
self.assertNotEqual(typing._overload_registry, {})
4408+
43944409
def set_up_overloads(self):
43954410
def blah():
43964411
pass

0 commit comments

Comments
 (0)
0