Skip to content

Commit 580e0e4

Browse files
brandtbucherilevkivskyi
authored andcommitted
Reenable PEP 570 tests. (#6923)
The `3.8-dev` Travis build environment now uses Python 3.8.0a4+! This is left over from #6900. We aren't running 3.8 test right now for other reasons, but I've confirmed that these pass fine on my local build (@JukkaL confirmed too in the PR).
1 parent ae99cad commit 580e0e4

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

mypy/test/testcheck.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@
9090
if sys.version_info >= (3, 8):
9191
typecheck_files.append('check-python38.test')
9292

93-
# Remove this once Travis supports 3.8.0a4+.
94-
if sys.version_info >= (3, 8, 0, "alpha", 4) and os.environ.get("TRAVIS"):
95-
import warnings
96-
warnings.warn("PEP 570 tests in check-python38.test can be unskipped! 🎉")
97-
9893
# Special tests for platforms with case-insensitive filesystems.
9994
if sys.platform in ('darwin', 'win32'):
10095
typecheck_files.append('check-modules-case.test')

test-data/unit/check-python38.test

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -107,77 +107,75 @@ def g(x: int): ...
107107
0 # type: ignore
108108
) # type: ignore # E: unused 'type: ignore' comment
109109

110-
-- Unskip the following PEP 570 tests once Travis supports 3.8.0a4 (or greater).
111-
112-
[case testPEP570ArgTypesMissing-skip]
110+
[case testPEP570ArgTypesMissing]
113111
# flags: --disallow-untyped-defs
114112
def f(arg, /) -> None: ... # E: Function is missing a type annotation for one or more arguments
115113

116-
[case testPEP570ArgTypesBadDefault-skip]
114+
[case testPEP570ArgTypesBadDefault]
117115
def f(arg: int = "ERROR", /) -> None: ... # E: Incompatible default for argument "arg" (default has type "str", argument has type "int")
118116

119-
[case testPEP570ArgTypesDefault-skip]
117+
[case testPEP570ArgTypesDefault]
120118
def f(arg: int = 0, /) -> None:
121119
reveal_type(arg) # E: Revealed type is 'builtins.int'
122120

123-
[case testPEP570ArgTypesRequired-skip]
121+
[case testPEP570ArgTypesRequired]
124122
def f(arg: int, /) -> None:
125123
reveal_type(arg) # E: Revealed type is 'builtins.int'
126124

127-
[case testPEP570Required-skip]
125+
[case testPEP570Required]
128126
def f(arg: int, /) -> None: ... # N: "f" defined here
129127
f(1)
130128
f("ERROR") # E: Argument 1 to "f" has incompatible type "str"; expected "int"
131129
f(arg=1) # E: Unexpected keyword argument "arg" for "f"
132130
f(arg="ERROR") # E: Unexpected keyword argument "arg" for "f"
133131

134-
[case testPEP570Default-skip]
132+
[case testPEP570Default]
135133
def f(arg: int = 0, /) -> None: ... # N: "f" defined here
136134
f()
137135
f(1)
138136
f("ERROR") # E: Argument 1 to "f" has incompatible type "str"; expected "int"
139137
f(arg=1) # E: Unexpected keyword argument "arg" for "f"
140138
f(arg="ERROR") # E: Unexpected keyword argument "arg" for "f"
141139

142-
[case testPEP570Calls-skip]
140+
[case testPEP570Calls]
143141
def f(p, /, p_or_kw, *, kw) -> None: ... # N: "f" defined here
144142
f(0, 0, 0) # E: Too many positional arguments for "f"
145143
f(0, 0, kw=0)
146144
f(0, p_or_kw=0, kw=0)
147145
f(p=0, p_or_kw=0, kw=0) # E: Unexpected keyword argument "p" for "f"
148146

149-
[case testPEP570Signatures1-skip]
147+
[case testPEP570Signatures1]
150148
def f(p1: bytes, p2: float, /, p_or_kw: int, *, kw: str) -> None:
151149
reveal_type(p1) # E: Revealed type is 'builtins.bytes'
152150
reveal_type(p2) # E: Revealed type is 'builtins.float'
153151
reveal_type(p_or_kw) # E: Revealed type is 'builtins.int'
154152
reveal_type(kw) # E: Revealed type is 'builtins.str'
155153

156-
[case testPEP570Signatures2-skip]
154+
[case testPEP570Signatures2]
157155
def f(p1: bytes, p2: float = 0.0, /, p_or_kw: int = 0, *, kw: str) -> None:
158156
reveal_type(p1) # E: Revealed type is 'builtins.bytes'
159157
reveal_type(p2) # E: Revealed type is 'builtins.float'
160158
reveal_type(p_or_kw) # E: Revealed type is 'builtins.int'
161159
reveal_type(kw) # E: Revealed type is 'builtins.str'
162160

163-
[case testPEP570Signatures3-skip]
161+
[case testPEP570Signatures3]
164162
def f(p1: bytes, p2: float = 0.0, /, *, kw: int) -> None:
165163
reveal_type(p1) # E: Revealed type is 'builtins.bytes'
166164
reveal_type(p2) # E: Revealed type is 'builtins.float'
167165
reveal_type(kw) # E: Revealed type is 'builtins.int'
168166

169-
[case testPEP570Signatures4-skip]
167+
[case testPEP570Signatures4]
170168
def f(p1: bytes, p2: int = 0, /) -> None:
171169
reveal_type(p1) # E: Revealed type is 'builtins.bytes'
172170
reveal_type(p2) # E: Revealed type is 'builtins.int'
173171

174-
[case testPEP570Signatures5-skip]
172+
[case testPEP570Signatures5]
175173
def f(p1: bytes, p2: float, /, p_or_kw: int) -> None:
176174
reveal_type(p1) # E: Revealed type is 'builtins.bytes'
177175
reveal_type(p2) # E: Revealed type is 'builtins.float'
178176
reveal_type(p_or_kw) # E: Revealed type is 'builtins.int'
179177

180-
[case testPEP570Signatures6-skip]
178+
[case testPEP570Signatures6]
181179
def f(p1: bytes, p2: float, /) -> None:
182180
reveal_type(p1) # E: Revealed type is 'builtins.bytes'
183181
reveal_type(p2) # E: Revealed type is 'builtins.float'

0 commit comments

Comments
 (0)