Skip to content

Commit

Permalink
pythongh-96478: Fix new test when run in refleak mode (python#96615)
Browse files Browse the repository at this point in the history
./python.exe -m test -R : test.test_typing would fail, apparently
because the dictionary used in the @patch decorator was modified.
  • Loading branch information
JelleZijlstra authored Sep 6, 2022
1 parent 222f10c commit f0d9136
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4391,19 +4391,19 @@ 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), [])
with patch("typing._overload_registry",
defaultdict(lambda: defaultdict(dict))):
# 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():
Expand Down

0 comments on commit f0d9136

Please sign in to comment.