@@ -115,28 +115,33 @@ def g(x: int): ...
115115) # type: ignore # E: Unused "type: ignore" comment
116116
117117[case testPEP570ArgTypesMissing]
118- # flags: --disallow-untyped-defs
118+ # flags: --python-version 3.8 -- disallow-untyped-defs
119119def f(arg, /) -> None: ... # E: Function is missing a type annotation for one or more arguments
120120
121121[case testPEP570ArgTypesBadDefault]
122+ # flags: --python-version 3.8
122123def f(arg: int = "ERROR", /) -> None: ... # E: Incompatible default for argument "arg" (default has type "str", argument has type "int")
123124
124125[case testPEP570ArgTypesDefault]
126+ # flags: --python-version 3.8
125127def f(arg: int = 0, /) -> None:
126128 reveal_type(arg) # N: Revealed type is "builtins.int"
127129
128130[case testPEP570ArgTypesRequired]
131+ # flags: --python-version 3.8
129132def f(arg: int, /) -> None:
130133 reveal_type(arg) # N: Revealed type is "builtins.int"
131134
132135[case testPEP570Required]
136+ # flags: --python-version 3.8
133137def f(arg: int, /) -> None: ... # N: "f" defined here
134138f(1)
135139f("ERROR") # E: Argument 1 to "f" has incompatible type "str"; expected "int"
136140f(arg=1) # E: Unexpected keyword argument "arg" for "f"
137141f(arg="ERROR") # E: Unexpected keyword argument "arg" for "f"
138142
139143[case testPEP570Default]
144+ # flags: --python-version 3.8
140145def f(arg: int = 0, /) -> None: ... # N: "f" defined here
141146f()
142147f(1)
@@ -145,6 +150,7 @@ f(arg=1) # E: Unexpected keyword argument "arg" for "f"
145150f(arg="ERROR") # E: Unexpected keyword argument "arg" for "f"
146151
147152[case testPEP570Calls]
153+ # flags: --python-version 3.8 --no-strict-optional
148154from typing import Any, Dict
149155def f(p, /, p_or_kw, *, kw) -> None: ... # N: "f" defined here
150156d = None # type: Dict[Any, Any]
@@ -157,42 +163,49 @@ f(**d) # E: Missing positional argument "p_or_kw" in call to "f"
157163[builtins fixtures/dict.pyi]
158164
159165[case testPEP570Signatures1]
166+ # flags: --python-version 3.8
160167def f(p1: bytes, p2: float, /, p_or_kw: int, *, kw: str) -> None:
161168 reveal_type(p1) # N: Revealed type is "builtins.bytes"
162169 reveal_type(p2) # N: Revealed type is "builtins.float"
163170 reveal_type(p_or_kw) # N: Revealed type is "builtins.int"
164171 reveal_type(kw) # N: Revealed type is "builtins.str"
165172
166173[case testPEP570Signatures2]
174+ # flags: --python-version 3.8
167175def f(p1: bytes, p2: float = 0.0, /, p_or_kw: int = 0, *, kw: str) -> None:
168176 reveal_type(p1) # N: Revealed type is "builtins.bytes"
169177 reveal_type(p2) # N: Revealed type is "builtins.float"
170178 reveal_type(p_or_kw) # N: Revealed type is "builtins.int"
171179 reveal_type(kw) # N: Revealed type is "builtins.str"
172180
173181[case testPEP570Signatures3]
182+ # flags: --python-version 3.8
174183def f(p1: bytes, p2: float = 0.0, /, *, kw: int) -> None:
175184 reveal_type(p1) # N: Revealed type is "builtins.bytes"
176185 reveal_type(p2) # N: Revealed type is "builtins.float"
177186 reveal_type(kw) # N: Revealed type is "builtins.int"
178187
179188[case testPEP570Signatures4]
189+ # flags: --python-version 3.8
180190def f(p1: bytes, p2: int = 0, /) -> None:
181191 reveal_type(p1) # N: Revealed type is "builtins.bytes"
182192 reveal_type(p2) # N: Revealed type is "builtins.int"
183193
184194[case testPEP570Signatures5]
195+ # flags: --python-version 3.8
185196def f(p1: bytes, p2: float, /, p_or_kw: int) -> None:
186197 reveal_type(p1) # N: Revealed type is "builtins.bytes"
187198 reveal_type(p2) # N: Revealed type is "builtins.float"
188199 reveal_type(p_or_kw) # N: Revealed type is "builtins.int"
189200
190201[case testPEP570Signatures6]
202+ # flags: --python-version 3.8
191203def f(p1: bytes, p2: float, /) -> None:
192204 reveal_type(p1) # N: Revealed type is "builtins.bytes"
193205 reveal_type(p2) # N: Revealed type is "builtins.float"
194206
195207[case testPEP570Unannotated]
208+ # flags: --python-version 3.8
196209def f(arg, /): ... # N: "f" defined here
197210g = lambda arg, /: arg
198211def h(arg=0, /): ... # N: "h" defined here
@@ -554,6 +567,7 @@ def foo() -> None:
554567[builtins fixtures/dict.pyi]
555568
556569[case testOverloadWithPositionalOnlySelf]
570+ # flags: --python-version 3.8
557571from typing import overload, Optional
558572
559573class Foo:
@@ -578,6 +592,7 @@ class Bar:
578592[builtins fixtures/bool.pyi]
579593
580594[case testUnpackWithDuplicateNamePositionalOnly]
595+ # flags: --python-version 3.8
581596from typing_extensions import Unpack, TypedDict
582597
583598class Person(TypedDict):
0 commit comments