summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2022-09-06 16:33:09 (GMT)
committerGitHub <noreply@github.com>2022-09-06 16:33:09 (GMT)
commitf0d9136c69b4ed32bfb3096f926da098623a7072 (patch)
treec12799d195a1a7b2a5434d3e475a0b2972f50a9c /Lib
parent222f10ca2d01c86fa2c53c2edd6884f117324297 (diff)
downloadcpython-f0d9136c69b4ed32bfb3096f926da098623a7072.zip
cpython-f0d9136c69b4ed32bfb3096f926da098623a7072.tar.gz
cpython-f0d9136c69b4ed32bfb3096f926da098623a7072.tar.bz2
gh-96478: Fix new test when run in refleak mode (#96615)
./python.exe -m test -R : test.test_typing would fail, apparently because the dictionary used in the @patch decorator was modified.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_typing.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index a3a6b4e..d68c325 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -4391,19 +4391,19 @@ class OverloadTests(BaseTestCase):
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():