From 7a0e7b9e70fe91c191ac58dc5311e8a380a54322 Mon Sep 17 00:00:00 2001 From: Hana Joo Date: Thu, 8 May 2025 07:07:53 -0700 Subject: [PATCH] Add a test case to confirm that an implied `typing.TypeVar` doesn't hide an existing symbol. PiperOrigin-RevId: 756296804 --- pytype/tests/test_typevar1.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pytype/tests/test_typevar1.py b/pytype/tests/test_typevar1.py index 3ab55fc0c..a0b6646d1 100644 --- a/pytype/tests/test_typevar1.py +++ b/pytype/tests/test_typevar1.py @@ -850,6 +850,16 @@ def f(x): """) self.assertErrorRegexes(errors, {"e": "Expected.*int.*Actual.*str"}) + @test_utils.skipBeforePy((3, 12), "PEP 695 - 3.12 feature") + def test_global_var_not_hidden_by_type_variable(self): + self.Check(""" + Apple: str = 'Apple' + type AppleBox[Apple] = tuple[Apple, ...] + def print_apple(a: str): + print(a) + print_apple(Apple) + """) + if __name__ == "__main__": test_base.main()