@@ -2394,7 +2394,7 @@ if bool():
2394
2394
2395
2395
[case testLocalPartialTypesWithGlobalInitializedToNone]
2396
2396
# flags: --local-partial-types
2397
- x = None # E: Need type annotation for "x"
2397
+ x = None # E: Need type annotation for "x" (hint: "x: Optional[<type>] = ...")
2398
2398
2399
2399
def f() -> None:
2400
2400
global x
@@ -2405,7 +2405,7 @@ reveal_type(x) # N: Revealed type is "None"
2405
2405
2406
2406
[case testLocalPartialTypesWithGlobalInitializedToNone2]
2407
2407
# flags: --local-partial-types
2408
- x = None # E: Need type annotation for "x"
2408
+ x = None # E: Need type annotation for "x" (hint: "x: Optional[<type>] = ...")
2409
2409
2410
2410
def f():
2411
2411
global x
@@ -2454,7 +2454,7 @@ reveal_type(a) # N: Revealed type is "builtins.str"
2454
2454
[case testLocalPartialTypesWithClassAttributeInitializedToNone]
2455
2455
# flags: --local-partial-types
2456
2456
class A:
2457
- x = None # E: Need type annotation for "x"
2457
+ x = None # E: Need type annotation for "x" (hint: "x: Optional[<type>] = ...")
2458
2458
2459
2459
def f(self) -> None:
2460
2460
self.x = 1
@@ -2637,7 +2637,7 @@ from typing import List
2637
2637
def f(x): pass
2638
2638
2639
2639
class A:
2640
- x = None # E: Need type annotation for "x"
2640
+ x = None # E: Need type annotation for "x" (hint: "x: Optional[<type>] = ...")
2641
2641
2642
2642
def f(self, p: List[str]) -> None:
2643
2643
self.x = f(p)
@@ -2647,15 +2647,15 @@ class A:
2647
2647
[case testLocalPartialTypesAccessPartialNoneAttribute]
2648
2648
# flags: --local-partial-types
2649
2649
class C:
2650
- a = None # E: Need type annotation for "a"
2650
+ a = None # E: Need type annotation for "a" (hint: "a: Optional[<type>] = ...")
2651
2651
2652
2652
def f(self, x) -> None:
2653
2653
C.a.y # E: Item "None" of "Optional[Any]" has no attribute "y"
2654
2654
2655
2655
[case testLocalPartialTypesAccessPartialNoneAttribute2]
2656
2656
# flags: --local-partial-types
2657
2657
class C:
2658
- a = None # E: Need type annotation for "a"
2658
+ a = None # E: Need type annotation for "a" (hint: "a: Optional[<type>] = ...")
2659
2659
2660
2660
def f(self, x) -> None:
2661
2661
self.a.y # E: Item "None" of "Optional[Any]" has no attribute "y"
0 commit comments