From 2b1bba258d3678b3152476e52bd01040337c4ca3 Mon Sep 17 00:00:00 2001 From: Bagou Ines Date: Thu, 9 Oct 2025 10:43:29 +0200 Subject: [PATCH] ajout du test unitaire issue_scope.test --- test-data/unit/issue_scope.test | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 test-data/unit/issue_scope.test diff --git a/test-data/unit/issue_scope.test b/test-data/unit/issue_scope.test new file mode 100644 index 000000000000..2ea013dd4e62 --- /dev/null +++ b/test-data/unit/issue_scope.test @@ -0,0 +1,17 @@ +[case testScopeOptionalIntResolution] +from typing import Optional + +x: Optional[int] = None +y: Optional[int] = None + +def f() -> None: + x = 1 + y = 1 + class C: + reveal_type(x) # should be int + reveal_type(y) # should be Optional[int] + x = 2 + +[out] +note: Revealed type is "builtins.int" +note: Revealed type is "Union[builtins.int, None]"