From 2979419f7bb10b554102e972351f8d03c8ffd1fa Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Tue, 6 Sep 2022 17:54:26 +0300 Subject: [PATCH] Backport python/cpython#96479 (#73) Issue: https://github.com/python/cpython/issues/96478 PR: https://github.com/python/cpython/pull/96479 --- src/test_typing_extensions.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py index 18a9132f..64d052b2 100644 --- a/src/test_typing_extensions.py +++ b/src/test_typing_extensions.py @@ -493,6 +493,23 @@ def blah(): blah() + @patch( + f"{registry_holder.__name__}._overload_registry", + defaultdict(lambda: defaultdict(dict)) + ) + def test_overload_on_compiled_functions(self): + registry = registry_holder._overload_registry + # The registry starts out empty: + self.assertEqual(registry, {}) + + # This should just not fail: + overload(sum) + overload(print) + + # No overloads are recorded: + self.assertEqual(get_overloads(sum), []) + self.assertEqual(get_overloads(print), []) + def set_up_overloads(self): def blah(): pass