Skip to content

Commit 33f4ae3

Browse files
authored
Unskip parse error tests (#21005)
1 parent 33bc712 commit 33f4ae3

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

mypy/test/testparse.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def run_case(self, testcase: DataDrivenTestCase) -> None:
9292
def test_parse_error(testcase: DataDrivenTestCase) -> None:
9393
try:
9494
options = parse_options("\n".join(testcase.input), testcase, 0)
95+
if options.python_version < defaults.PYTHON3_VERSION:
96+
options.python_version = defaults.PYTHON3_VERSION
9597
if options.python_version != sys.version_info[:2]:
9698
skip()
9799
# Compile temporary file. The test file contains non-ASCII characters.

test-data/unit/parse-errors.test

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
def f()
1313
pass
1414
[out]
15-
file:1: error: Invalid syntax
15+
file:1: error: Expected ':'
1616

1717
[case testUnexpectedIndent]
1818
1
@@ -55,7 +55,7 @@ file:1: error: Invalid syntax
5555
[case testUnexpectedEof]
5656
if 1:
5757
[out]
58-
file:1: error: Expected an indented block
58+
file:1: error: Expected an indented block after 'if' statement on line 1
5959

6060
[case testInvalidKeywordArguments1]
6161
f(x=y, z)
@@ -281,17 +281,17 @@ file:3: error: Inconsistent use of "**" in function signature
281281
[case testPrintStatementInPython3]
282282
print 1
283283
[out]
284-
file:1: error: Missing parentheses in call to 'print'. Did you mean print(1)?
284+
file:1: error: Missing parentheses in call to 'print'. Did you mean print(...)?
285285

286286
[case testInvalidConditionInConditionalExpression]
287287
1 if 2, 3 else 4
288288
[out]
289-
file:1: error: Invalid syntax
289+
file:1: error: Expected 'else' after 'if' expression
290290

291291
[case testInvalidConditionInConditionalExpression2]
292292
1 if x for y in z else 4
293293
[out]
294-
file:1: error: Invalid syntax
294+
file:1: error: Expected 'else' after 'if' expression
295295

296296
[case testInvalidConditionInConditionalExpression3]
297297
1 if x else for y in z
@@ -360,17 +360,17 @@ file:1: error: Invalid syntax
360360
[case testParseErrorInExtendedSlicing]
361361
x[:,
362362
[out]
363-
file:1: error: Unexpected EOF while parsing
363+
file:1: error: '[' was never closed
364364

365365
[case testParseErrorInExtendedSlicing2]
366366
x[:,::
367367
[out]
368-
file:1: error: Unexpected EOF while parsing
368+
file:1: error: '[' was never closed
369369

370370
[case testParseErrorInExtendedSlicing3]
371371
x[:,:
372372
[out]
373-
file:1: error: Unexpected EOF while parsing
373+
file:1: error: '[' was never closed
374374

375375
[case testInvalidEncoding]
376376
# foo
@@ -407,7 +407,7 @@ file:0: error: Unknown encoding: uft8
407407
2L
408408
0x2L
409409
[out]
410-
file:1: error: Invalid syntax
410+
file:1: error: Invalid decimal literal
411411

412412
[case testPython2LegacyInequalityInPython3]
413413
1 <> 2
@@ -440,4 +440,4 @@ try:
440440
except KeyError, IndexError:
441441
pass
442442
[out]
443-
file:3: error: Invalid syntax
443+
file:3: error: Multiple exception types must be parenthesized

0 commit comments

Comments
 (0)