Skip to content

Commit

Permalink
gh-96478: Test @overload on C functions (GH-96479)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Waygood <[email protected]>
(cherry picked from commit f177f6f)

Co-authored-by: Nikita Sobolev <[email protected]>
  • Loading branch information
miss-islington and sobolevn authored Sep 21, 2022
1 parent a670c65 commit 2a5e333
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4379,6 +4379,20 @@ def blah():

blah()

@patch("typing._overload_registry",
defaultdict(lambda: defaultdict(dict)))
def test_overload_on_compiled_functions(self):
# The registry starts out empty:
self.assertEqual(typing._overload_registry, {})

# This should just not fail:
overload(sum)
overload(print)

# No overloads are recorded (but, it still has a side-effect):
self.assertEqual(typing.get_overloads(sum), [])
self.assertEqual(typing.get_overloads(print), [])

def set_up_overloads(self):
def blah():
pass
Expand Down

0 comments on commit 2a5e333

Please sign in to comment.