Debian Codegraph @

test-data/unit/check-lowercase.test

raw
1 [case testTupleLowercase]
2 x = (3,)
3 x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "tuple[int]")
4 [builtins fixtures/tuple.pyi]
5
6 [case testListLowercase]
7 x = [3]
8 x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "list[int]")
9
10 [case testDictLowercase]
11 x = {"key": "value"}
12 x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "dict[str, str]")
13
14 [case testSetLowercase]
15 x = {3}
16 x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "set[int]")
17 [builtins fixtures/set.pyi]
18
19 [case testTypeLowercase]
20 x: type[type]
21 y: int
22
23 y = x # E: Incompatible types in assignment (expression has type "type[type]", variable has type "int")
24
25 [case testLowercaseTypeAnnotationHint]
26 x = [] # E: Need type annotation for "x" (hint: "x: list[<type>] = ...")
27 y = {} # E: Need type annotation for "y" (hint: "y: dict[<type>, <type>] = ...")
28 z = set() # E: Need type annotation for "z" (hint: "z: set[<type>] = ...")
29 [builtins fixtures/primitives.pyi]
30
31 [case testLowercaseRevealTypeType]
32 def f(t: type[int]) -> None:
33 reveal_type(t) # N: Revealed type is "type[builtins.int]"
34 reveal_type(f) # N: Revealed type is "def (t: type[builtins.int])"
35 [builtins fixtures/primitives.pyi]