Skip to content

Commit ce7f920

Browse files
Changed error tests and message for 'invalid syntax -> Invalid syntax'
1 parent 6080839 commit ce7f920

15 files changed

+87
-87
lines changed

mypy/fastparse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def parse(
302302
# lineno within the file.
303303
e.lineno = None
304304
message = e.msg
305-
if feature_version > sys.version_info.minor and message.startswith("invalid syntax"):
305+
if feature_version > sys.version_info.minor and message.startswith("Invalid syntax"):
306306
python_version_str = f"{options.python_version[0]}.{options.python_version[1]}"
307307
message += f"; you likely need to run mypy using Python {python_version_str} or newer"
308308
errors.report(

mypy/test/teststubtest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ def test_mypy_build(self) -> None:
19581958
output = run_stubtest(stub="+", runtime="", options=[])
19591959
assert remove_color_code(output) == (
19601960
"error: not checking stubs due to failed mypy compile:\n{}.pyi:1: "
1961-
"error: invalid syntax [syntax]\n".format(TEST_MODULE_NAME)
1961+
"error: Invalid syntax [syntax]\n".format(TEST_MODULE_NAME)
19621962
)
19631963

19641964
output = run_stubtest(stub="def f(): ...\ndef f(): ...", runtime="", options=[])

test-data/unit/check-basic.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ x in 1, # E: Unsupported right operand type for in ("int")
281281
[case testTrailingCommaInIfParsing]
282282
if x in 1, : pass
283283
[out]
284-
main:1: error: invalid syntax
284+
main:1: error: Invalid syntax
285285

286286
[case testInitReturnTypeError]
287287
class C:

test-data/unit/check-columns.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
f()
55
1 +
66
[out]
7-
main:2:5: error: invalid syntax
7+
main:2:5: error: Invalid syntax
88

99
[case testColumnsNestedFunctions]
1010
import typing

test-data/unit/check-errorcodes.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ reveal_type(1) # N: Revealed type is "Literal[1]?"
3333
[case testErrorCodeSyntaxError]
3434
1 ''
3535
[out]
36-
main:1: error: invalid syntax [syntax]
36+
main:1: error: Invalid syntax [syntax]
3737
[out version==3.10.0]
38-
main:1: error: invalid syntax. Perhaps you forgot a comma? [syntax]
38+
main:1: error: Invalid syntax. Perhaps you forgot a comma? [syntax]
3939

4040
[case testErrorCodeSyntaxError2]
4141
def f(): # E: Type signature has too many arguments [syntax]

test-data/unit/check-expressions.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1783,7 +1783,7 @@ None < None # E: Unsupported left operand type for < ("None")
17831783

17841784
[case testDictWithStarExpr]
17851785

1786-
b = {'z': 26, *a} # E: invalid syntax
1786+
b = {'z': 26, *a} # E: Invalid syntax
17871787
[builtins fixtures/dict.pyi]
17881788

17891789
[case testDictWithStarStarExpr]

test-data/unit/check-fastparse.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[case testFastParseSyntaxError]
22

3-
1 + # E: invalid syntax
3+
1 + # E: Invalid syntax
44

55
[case testFastParseTypeCommentSyntaxError]
66

test-data/unit/check-ignore.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ from m import a # type: ignore
3838
[file m.py]
3939
+
4040
[out]
41-
tmp/m.py:1: error: invalid syntax
41+
tmp/m.py:1: error: Invalid syntax
4242

4343
[case testIgnoreAppliesOnlyToMissing]
4444
import a # type: ignore
@@ -59,7 +59,7 @@ from m import * # type: ignore
5959
[file m.py]
6060
+
6161
[out]
62-
tmp/m.py:1: error: invalid syntax
62+
tmp/m.py:1: error: Invalid syntax
6363

6464
[case testIgnoreAssignmentTypeError]
6565
x = 1

test-data/unit/check-newsyntax.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ x: int = 5 # E: Variable annotation syntax is only supported in Python 3.6 and
55

66
[case testNewSyntaxSyntaxError]
77
# flags: --python-version 3.6
8-
x: int: int # E: invalid syntax
8+
x: int: int # E: Invalid syntax
99
[out]
1010

1111
[case testNewSyntaxBasics]
@@ -156,4 +156,4 @@ reveal_type(f'{1}') # N: Revealed type is "builtins.str"
156156
# flags: --python-version 3.99
157157
x *** x this is what future python looks like public static void main String[] args await goto exit
158158
[out]
159-
main:2: error: invalid syntax; you likely need to run mypy using Python 3.99 or newer
159+
main:2: error: Invalid syntax; you likely need to run mypy using Python 3.99 or newer

test-data/unit/check-parameter-specification.test

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ def f2(c: Callable[P, R]) -> Callable[Concatenate[int, P], R]:
592592
f2(lambda x: 42)(42, x=42)
593593
[builtins fixtures/paramspec.pyi]
594594
[out]
595-
main:10: error: invalid syntax; you likely need to run mypy using Python 3.8 or newer
595+
main:10: error: Invalid syntax; you likely need to run mypy using Python 3.8 or newer
596596
[out version>=3.8]
597597
main:17: error: Incompatible return value type (got "Callable[[Arg(int, 'x'), **P], R]", expected "Callable[[int, **P], R]")
598598
main:17: note: This is likely because "result" has named arguments: "x". Consider marking them positional-only
@@ -621,7 +621,7 @@ def f2(c: Callable[P, R]) -> Callable[Concatenate[int, P], R]:
621621
f2(lambda x: 42)(42, x=42)
622622
[builtins fixtures/paramspec.pyi]
623623
[out]
624-
main:11: error: invalid syntax; you likely need to run mypy using Python 3.8 or newer
624+
main:11: error: Invalid syntax; you likely need to run mypy using Python 3.8 or newer
625625
[out version>=3.8]
626626

627627
[case testParamSpecConcatenateWithTypeVar]
@@ -662,7 +662,7 @@ reveal_type(abc)
662662
bar(abc)
663663
[builtins fixtures/paramspec.pyi]
664664
[out]
665-
main:13: error: invalid syntax; you likely need to run mypy using Python 3.8 or newer
665+
main:13: error: Invalid syntax; you likely need to run mypy using Python 3.8 or newer
666666
[out version>=3.8]
667667
main:16: note: Revealed type is "__main__.Foo[[builtins.int, b: builtins.str]]"
668668

0 commit comments

Comments
 (0)