-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathcheck-lowercase.test
More file actions
65 lines (53 loc) · 2.64 KB
/
check-lowercase.test
File metadata and controls
65 lines (53 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
[case testTupleLowercaseSettingOff]
# flags: --python-version 3.9 --force-uppercase-builtins
x = (3,)
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "Tuple[int]")
[builtins fixtures/tuple.pyi]
[case testTupleLowercaseSettingOn]
# flags: --python-version 3.9 --no-force-uppercase-builtins
x = (3,)
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "tuple[int]")
[builtins fixtures/tuple.pyi]
[case testListLowercaseSettingOff]
# flags: --python-version 3.9 --force-uppercase-builtins
x = [3]
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "List[int]")
[case testListLowercaseSettingOn]
# flags: --python-version 3.9 --no-force-uppercase-builtins
x = [3]
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "list[int]")
[case testDictLowercaseSettingOff]
# flags: --python-version 3.9 --force-uppercase-builtins
x = {"key": "value"}
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "Dict[str, str]")
[case testDictLowercaseSettingOn]
# flags: --python-version 3.9 --no-force-uppercase-builtins
x = {"key": "value"}
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "dict[str, str]")
[case testSetLowercaseSettingOff]
# flags: --python-version 3.9 --force-uppercase-builtins
x = {3}
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "Set[int]")
[builtins fixtures/set.pyi]
[case testSetLowercaseSettingOn]
# flags: --python-version 3.9 --no-force-uppercase-builtins
x = {3}
x = 3 # E: Incompatible types in assignment (expression has type "int", variable has type "set[int]")
[builtins fixtures/set.pyi]
[case testTypeLowercaseSettingOff]
# flags: --python-version 3.9 --no-force-uppercase-builtins
x: type[type]
y: int
y = x # E: Incompatible types in assignment (expression has type "type[type]", variable has type "int")
[case testLowercaseSettingOnTypeAnnotationHint]
# flags: --python-version 3.9 --no-force-uppercase-builtins
x = [] # E: Need type annotation for "x" (hint: "x: list[<type>] = ...")
y = {} # E: Need type annotation for "y" (hint: "y: dict[<type>, <type>] = ...")
z = set() # E: Need type annotation for "z" (hint: "z: set[<type>] = ...")
[builtins fixtures/primitives.pyi]
[case testLowercaseSettingOnRevealTypeType]
# flags: --python-version 3.9 --no-force-uppercase-builtins
def f(t: type[int]) -> None:
reveal_type(t) # N: Revealed type is "type[builtins.int]"
reveal_type(f) # N: Revealed type is "def (t: type[builtins.int])"
[builtins fixtures/primitives.pyi]