diff --git a/mypy/fastparse.py b/mypy/fastparse.py index aed04c6f2eb9..6c59f44829bb 100644 --- a/mypy/fastparse.py +++ b/mypy/fastparse.py @@ -270,7 +270,9 @@ def parse( errors.report( e.lineno if e.lineno is not None else -1, e.offset, - message, + re.sub( + r"^(\s*\w)", lambda m: m.group(1).upper(), message + ), # Standardizing error message blocker=True, code=codes.SYNTAX, ) diff --git a/mypy/test/teststubtest.py b/mypy/test/teststubtest.py index 492897d33a4a..7925f2a6bd3e 100644 --- a/mypy/test/teststubtest.py +++ b/mypy/test/teststubtest.py @@ -2581,7 +2581,7 @@ def test_mypy_build(self) -> None: output = run_stubtest(stub="+", runtime="", options=[]) assert output == ( "error: not checking stubs due to failed mypy compile:\n{}.pyi:1: " - "error: invalid syntax [syntax]\n".format(TEST_MODULE_NAME) + "error: Invalid syntax [syntax]\n".format(TEST_MODULE_NAME) ) output = run_stubtest(stub="def f(): ...\ndef f(): ...", runtime="", options=[]) diff --git a/test-data/unit/check-basic.test b/test-data/unit/check-basic.test index 6ecbbdcc13eb..3f2164bf5a24 100644 --- a/test-data/unit/check-basic.test +++ b/test-data/unit/check-basic.test @@ -289,7 +289,7 @@ x in 1, # E: Unsupported right operand type for in ("int") [case testTrailingCommaInIfParsing] if x in 1, : pass [out] -main:1: error: invalid syntax +main:1: error: Invalid syntax [case testInitReturnTypeError] class C: diff --git a/test-data/unit/check-columns.test b/test-data/unit/check-columns.test index 8f91d99a0576..c18313bbc24f 100644 --- a/test-data/unit/check-columns.test +++ b/test-data/unit/check-columns.test @@ -4,7 +4,7 @@ f() 1 + [out] -main:2:5: error: invalid syntax +main:2:5: error: Invalid syntax [case testColumnsNestedFunctions] import typing diff --git a/test-data/unit/check-errorcodes.test b/test-data/unit/check-errorcodes.test index 21112b7d85a2..0cd6dc081629 100644 --- a/test-data/unit/check-errorcodes.test +++ b/test-data/unit/check-errorcodes.test @@ -33,9 +33,9 @@ reveal_type(1) # N: Revealed type is "Literal[1]?" [case testErrorCodeSyntaxError] 1 '' [out] -main:1: error: invalid syntax [syntax] +main:1: error: Invalid syntax [syntax] [out version==3.10.0] -main:1: error: invalid syntax. Perhaps you forgot a comma? [syntax] +main:1: error: Invalid syntax. Perhaps you forgot a comma? [syntax] [case testErrorCodeSyntaxError2] def f(): # E: Type signature has too many arguments [syntax] diff --git a/test-data/unit/check-expressions.test b/test-data/unit/check-expressions.test index 81eb4c7c0dc8..a3b15a3b1da4 100644 --- a/test-data/unit/check-expressions.test +++ b/test-data/unit/check-expressions.test @@ -1861,7 +1861,7 @@ None < None # E: Unsupported left operand type for < ("None") [case testDictWithStarExpr] -b = {'z': 26, *a} # E: invalid syntax +b = {'z': 26, *a} # E: Invalid syntax [builtins fixtures/dict.pyi] [case testDictWithStarStarExpr] diff --git a/test-data/unit/check-fastparse.test b/test-data/unit/check-fastparse.test index f93e4fe07218..80d314333ddc 100644 --- a/test-data/unit/check-fastparse.test +++ b/test-data/unit/check-fastparse.test @@ -1,6 +1,6 @@ [case testFastParseSyntaxError] -1 + # E: invalid syntax +1 + # E: Invalid syntax [case testFastParseTypeCommentSyntaxError] @@ -158,7 +158,7 @@ def f(a, # type: A [case testFastParsePerArgumentAnnotationsWithAnnotatedBareStar] -def f(*, # type: int # E: bare * has associated type comment +def f(*, # type: int # E: Bare * has associated type comment x # type: str ): # type: (...) -> int diff --git a/test-data/unit/check-ignore.test b/test-data/unit/check-ignore.test index fa451f373e70..a4234e7a37a1 100644 --- a/test-data/unit/check-ignore.test +++ b/test-data/unit/check-ignore.test @@ -38,7 +38,7 @@ from m import a # type: ignore [file m.py] + [out] -tmp/m.py:1: error: invalid syntax +tmp/m.py:1: error: Invalid syntax [case testIgnoreAppliesOnlyToMissing] import a # type: ignore @@ -59,7 +59,7 @@ from m import * # type: ignore [file m.py] + [out] -tmp/m.py:1: error: invalid syntax +tmp/m.py:1: error: Invalid syntax [case testIgnoreAssignmentTypeError] x = 1 diff --git a/test-data/unit/check-newsyntax.test b/test-data/unit/check-newsyntax.test index 3ed4c6d3d8e2..a696eb2932fe 100644 --- a/test-data/unit/check-newsyntax.test +++ b/test-data/unit/check-newsyntax.test @@ -1,5 +1,5 @@ [case testNewSyntaxSyntaxError] -x: int: int # E: invalid syntax +x: int: int # E: Invalid syntax [out] [case testNewSyntaxBasics] @@ -126,4 +126,4 @@ reveal_type(f'{1}') # N: Revealed type is "builtins.str" # flags: --python-version 3.99 x *** x this is what future python looks like public static void main String[] args await goto exit [out] -main:2: error: invalid syntax; you likely need to run mypy using Python 3.99 or newer +main:2: error: Invalid syntax; you likely need to run mypy using Python 3.99 or newer diff --git a/test-data/unit/check-statements.test b/test-data/unit/check-statements.test index 9f77100863be..b0b673f696e1 100644 --- a/test-data/unit/check-statements.test +++ b/test-data/unit/check-statements.test @@ -1311,7 +1311,7 @@ def f() -> Iterator[List[int]]: [case testYieldFromNotAppliedToNothing] def h(): - yield from # E: invalid syntax + yield from # E: Invalid syntax [out] [case testYieldFromAndYieldTogether] diff --git a/test-data/unit/cmdline.test b/test-data/unit/cmdline.test index 748a655d5a10..fb2e0c01fe0e 100644 --- a/test-data/unit/cmdline.test +++ b/test-data/unit/cmdline.test @@ -896,7 +896,7 @@ some_file.py:11: error: Argument 1 to "some_interesting_method" of [file some_file.py] it_looks_like_we_started_typing_something_but_then. = did_not_notice(an_extra_dot) [out] -some_file.py:1: error: invalid syntax [syntax] +some_file.py:1: error: Invalid syntax [syntax] ...ooks_like_we_started_typing_something_but_then. = did_not_notice(an_ex... ^ == Return code: 2 @@ -1035,15 +1035,15 @@ public static void main(String[] args) [file pkg/y.py] x: str = 0 [out] -pkg/x.py:1: error: invalid syntax +pkg/x.py:1: error: Invalid syntax Found 1 error in 1 file (errors prevented further checking) == Return code: 2 [out version>=3.10] -pkg/x.py:1: error: invalid syntax. Perhaps you forgot a comma? +pkg/x.py:1: error: Invalid syntax. Perhaps you forgot a comma? Found 1 error in 1 file (errors prevented further checking) == Return code: 2 [out version>=3.10.3] -pkg/x.py:1: error: invalid syntax +pkg/x.py:1: error: Invalid syntax Found 1 error in 1 file (errors prevented further checking) == Return code: 2 diff --git a/test-data/unit/fine-grained-blockers.test b/test-data/unit/fine-grained-blockers.test index 33dedd887114..8e16da053d6a 100644 --- a/test-data/unit/fine-grained-blockers.test +++ b/test-data/unit/fine-grained-blockers.test @@ -19,13 +19,13 @@ def f(x: int) -> None: pass def f() -> None: pass [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == main:2: error: Missing positional argument "x" in call to "f" == [out version>=3.10] == -a.py:1: error: expected ':' +a.py:1: error: Expected ':' == main:2: error: Missing positional argument "x" in call to "f" == @@ -44,7 +44,7 @@ def f(x: int) -> None: pass def f() -> None: pass [out] == -a.py:1: error: invalid syntax [syntax] +a.py:1: error: Invalid syntax [syntax] def f(x: int) -> ^ == @@ -54,7 +54,7 @@ main:3: error: Missing positional argument "x" in call to "f" [call-arg] == [out version>=3.10] == -a.py:1: error: expected ':' [syntax] +a.py:1: error: Expected ':' [syntax] def f(x: int) -> ^ == @@ -77,16 +77,16 @@ def f(x: int def f(x: int) -> None: pass [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == -a.py:2: error: invalid syntax +a.py:2: error: Invalid syntax == main:2: error: Missing positional argument "x" in call to "f" [out version>=3.10] == -a.py:1: error: expected ':' +a.py:1: error: Expected ':' == -a.py:2: error: expected ':' +a.py:2: error: Expected ':' == main:2: error: Missing positional argument "x" in call to "f" @@ -124,7 +124,7 @@ def f() -> None: pass main:3: error: Too many arguments for "f" main:5: error: Too many arguments for "f" == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == main:3: error: Too many arguments for "f" main:5: error: Too many arguments for "f" @@ -132,7 +132,7 @@ main:5: error: Too many arguments for "f" main:3: error: Too many arguments for "f" main:5: error: Too many arguments for "f" == -a.py:1: error: expected ':' +a.py:1: error: Expected ':' == main:3: error: Too many arguments for "f" main:5: error: Too many arguments for "f" @@ -153,12 +153,12 @@ class C: def f(self, x: int) -> None: pass [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == main:5: error: Missing positional argument "x" in call to "f" of "C" [out version==3.10.0] == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == main:5: error: Missing positional argument "x" in call to "f" of "C" @@ -173,14 +173,14 @@ def f() -> None: pass main:1: error: Cannot find implementation or library stub for module named "a" main:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == main:2: error: Too many arguments for "f" [out version==3.10.0] main:1: error: Cannot find implementation or library stub for module named "a" main:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == main:2: error: Too many arguments for "f" @@ -208,7 +208,7 @@ a.f() def g() -> None: pass [out] == -b.py:1: error: invalid syntax +b.py:1: error: Invalid syntax == [case testModifyTwoFilesOneWithBlockingError2] @@ -235,7 +235,7 @@ def f() -> None: pass b.g() [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == [case testBlockingErrorRemainsUnfixed] @@ -254,16 +254,16 @@ import b b.f() [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == a.py:2: error: Missing positional argument "x" in call to "f" [out version==3.10.0] == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == a.py:2: error: Missing positional argument "x" in call to "f" @@ -303,9 +303,9 @@ def g() -> None: pass a.f(1) [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == a.py:3: error: Too many arguments for "g" b.py:3: error: Too many arguments for "f" @@ -325,14 +325,14 @@ x x [delete a.py.3] [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == main:1: error: Cannot find implementation or library stub for module named "a" main:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports b.py:1: error: Cannot find implementation or library stub for module named "a" [out version==3.10.0] == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == main:1: error: Cannot find implementation or library stub for module named "a" main:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports @@ -353,14 +353,14 @@ x x [delete a.py.3] [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == b.py:1: error: Cannot find implementation or library stub for module named "a" b.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports main:1: error: Cannot find implementation or library stub for module named "a" [out version==3.10.0] == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == b.py:1: error: Cannot find implementation or library stub for module named "a" b.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports @@ -382,17 +382,17 @@ a.f() [builtins fixtures/module.pyi] [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == b.py:2: error: Module has no attribute "f" b.py:3: error: "int" not callable [out version==3.10.0] == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == b.py:2: error: Module has no attribute "f" b.py:3: error: "int" not callable @@ -408,12 +408,12 @@ import blocker def f() -> None: pass [out] == -/test-data/unit/lib-stub/blocker.pyi:2: error: invalid syntax +/test-data/unit/lib-stub/blocker.pyi:2: error: Invalid syntax == a.py:1: error: "int" not callable [out version==3.10.0] == -/test-data/unit/lib-stub/blocker.pyi:2: error: invalid syntax. Perhaps you forgot a comma? +/test-data/unit/lib-stub/blocker.pyi:2: error: Invalid syntax. Perhaps you forgot a comma? == a.py:1: error: "int" not callable @@ -485,16 +485,16 @@ import sys [builtins fixtures/tuple.pyi] [out] == -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == -/test-data/unit/lib-stub/blocker.pyi:2: error: invalid syntax +/test-data/unit/lib-stub/blocker.pyi:2: error: Invalid syntax == a.py:2: error: "int" not callable [out version==3.10.0] == -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == -/test-data/unit/lib-stub/blocker.pyi:2: error: invalid syntax. Perhaps you forgot a comma? +/test-data/unit/lib-stub/blocker.pyi:2: error: Invalid syntax. Perhaps you forgot a comma? == a.py:2: error: "int" not callable @@ -511,12 +511,12 @@ x = 1 def f() -> int: return 0 [out] -a.py:1: error: invalid syntax +a.py:1: error: Invalid syntax == b.py:2: error: Incompatible return value type (got "str", expected "int") == [out version==3.10.0] -a.py:1: error: invalid syntax. Perhaps you forgot a comma? +a.py:1: error: Invalid syntax. Perhaps you forgot a comma? == b.py:2: error: Incompatible return value type (got "str", expected "int") == diff --git a/test-data/unit/fine-grained-suggest.test b/test-data/unit/fine-grained-suggest.test index 2539886229cf..ba6006300a4c 100644 --- a/test-data/unit/fine-grained-suggest.test +++ b/test-data/unit/fine-grained-suggest.test @@ -1035,10 +1035,10 @@ def foo(): ( [out] -foo.py:4: error: unexpected EOF while parsing +foo.py:4: error: Unexpected EOF while parsing Command 'suggest' is only valid after a 'check' command (that produces no parse errors) == -foo.py:4: error: unexpected EOF while parsing +foo.py:4: error: Unexpected EOF while parsing [out version>=3.10] foo.py:4: error: '(' was never closed Command 'suggest' is only valid after a 'check' command (that produces no parse errors) diff --git a/test-data/unit/parse-errors.test b/test-data/unit/parse-errors.test index 33c2a6ddf5c0..a192cc02d0cc 100644 --- a/test-data/unit/parse-errors.test +++ b/test-data/unit/parse-errors.test @@ -12,102 +12,102 @@ def f() pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testUnexpectedIndent] 1 2 [out] -file:2: error: unexpected indent +file:2: error: Unexpected indent [case testInconsistentIndent] if x: 1 1 [out] -file:3: error: unexpected indent +file:3: error: Unexpected indent [case testInconsistentIndent2] if x: 1 1 [out] -file:3: error: unindent does not match any outer indentation level +file:3: error: Unindent does not match any outer indentation level [case testInvalidBinaryOp] 1> a* a+1* [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testDoubleStar] **a [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testMissingSuperClass] class A(: pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testUnexpectedEof] if 1: [out] -file:1: error: expected an indented block +file:1: error: Expected an indented block [case testInvalidKeywordArguments1] f(x=y, z) [out] -file:1: error: positional argument follows keyword argument +file:1: error: Positional argument follows keyword argument [case testInvalidKeywordArguments2] f(**x, y) [out] -file:1: error: positional argument follows keyword argument unpacking +file:1: error: Positional argument follows keyword argument unpacking [case testInvalidBareAsteriskAndVarArgs2] def f(*x: A, *) -> None: pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidBareAsteriskAndVarArgs3] def f(*, *x: A) -> None: pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidBareAsteriskAndVarArgs4] def f(*, **x: A) -> None: pass [out] -file:1: error: named arguments must follow bare * +file:1: error: Named arguments must follow bare * [case testInvalidBareAsterisk1] def f(*) -> None: pass [out] -file:1: error: named arguments must follow bare * +file:1: error: Named arguments must follow bare * [case testInvalidBareAsterisk2] def f(x, *) -> None: pass [out] -file:1: error: named arguments must follow bare * +file:1: error: Named arguments must follow bare * [case testInvalidFuncDefArgs1] def f(x = y, x): pass [out] -file:1: error: non-default argument follows default argument +file:1: error: Non-default argument follows default argument [case testInvalidFuncDefArgs3] def f(**x, y): pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidFuncDefArgs4] def f(**x, y=x): pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidTypeComment] 0 @@ -154,7 +154,7 @@ file:2: error: Syntax error in type comment "A B" [case testMissingBracket] def foo( [out] -file:1: error: unexpected EOF while parsing +file:1: error: Unexpected EOF while parsing [out version>=3.10] file:1: error: '(' was never closed @@ -288,153 +288,153 @@ file:1: error: Missing parentheses in call to 'print'. Did you mean print(1)? [case testInvalidConditionInConditionalExpression] 1 if 2, 3 else 4 [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidConditionInConditionalExpression2] 1 if x for y in z else 4 [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidConditionInConditionalExpression3] 1 if x else for y in z [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testYieldFromNotRightParameter] def f(): yield from [out] -file:2: error: invalid syntax +file:2: error: Invalid syntax [case testYieldFromAfterReturn] def f(): return yield from h() [out] -file:2: error: invalid syntax +file:2: error: Invalid syntax [case testImportDotModule] import .x [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testImportDot] import . [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidFunctionName] def while(): pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testInvalidEllipsis1] ...0 ..._ ...a [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testBlockStatementInSingleLineIf] if 1: if 2: pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testBlockStatementInSingleLineIf2] if 1: while 2: pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testBlockStatementInSingleLineIf3] if 1: for x in y: pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testUnexpectedEllipsis] a = a... [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testParseErrorBeforeUnicodeLiteral] x u'y' [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testParseErrorInExtendedSlicing] x[:, [out] -file:1: error: unexpected EOF while parsing +file:1: error: Unexpected EOF while parsing [case testParseErrorInExtendedSlicing2] x[:,:: [out] -file:1: error: unexpected EOF while parsing +file:1: error: Unexpected EOF while parsing [case testParseErrorInExtendedSlicing3] x[:,: [out] -file:1: error: unexpected EOF while parsing +file:1: error: Unexpected EOF while parsing [case testInvalidEncoding] # foo # coding: uft-8 [out] -file:0: error: unknown encoding: uft-8 +file:0: error: Unknown encoding: uft-8 [case testInvalidEncoding2] # coding=Uft.8 [out] -file:0: error: unknown encoding: Uft.8 +file:0: error: Unknown encoding: Uft.8 [case testInvalidEncoding3] #!/usr/bin python # vim: set fileencoding=uft8 : [out] -file:0: error: unknown encoding: uft8 +file:0: error: Unknown encoding: uft8 [case testDoubleEncoding] # coding: uft8 # coding: utf8 # The first coding cookie should be used and fail. [out] -file:0: error: unknown encoding: uft8 +file:0: error: Unknown encoding: uft8 [case testDoubleEncoding2] # Again the first cookie should be used and fail. # coding: uft8 # coding: utf8 [out] -file:0: error: unknown encoding: uft8 +file:0: error: Unknown encoding: uft8 [case testLongLiteralInPython3] 2L 0x2L [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testPython2LegacyInequalityInPython3] 1 <> 2 [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testLambdaInListComprehensionInPython3] ([ 0 for x in 1, 2 if 3 ]) [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testTupleArgListInPython3] def f(x, (y, z)): pass [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testBackquoteInPython3] `1 + 2` [out] -file:1: error: invalid syntax +file:1: error: Invalid syntax [case testSmartQuotes] foo = β€˜bar’ [out] -file:1: error: invalid character 'β€˜' (U+2018) +file:1: error: Invalid character 'β€˜' (U+2018) [case testExceptCommaInPython3] try: @@ -442,4 +442,4 @@ try: except KeyError, IndexError: pass [out] -file:3: error: invalid syntax +file:3: error: Invalid syntax diff --git a/test-data/unit/parse.test b/test-data/unit/parse.test index 943ca49081f1..fa1d797fada4 100644 --- a/test-data/unit/parse.test +++ b/test-data/unit/parse.test @@ -932,20 +932,20 @@ MypyFile:1( [case testNotAsBinaryOp] x not y [out] -main:1: error: invalid syntax +main:1: error: Invalid syntax [out version==3.10.0] -main:1: error: invalid syntax. Perhaps you forgot a comma? +main:1: error: Invalid syntax. Perhaps you forgot a comma? [case testNotIs] -x not is y # E: invalid syntax +x not is y # E: Invalid syntax [out] [case testBinaryNegAsBinaryOp] 1 ~ 2 [out] -main:1: error: invalid syntax +main:1: error: Invalid syntax [out version==3.10.0] -main:1: error: invalid syntax. Perhaps you forgot a comma? +main:1: error: Invalid syntax. Perhaps you forgot a comma? [case testSliceInList39] # flags: --python-version 3.9 @@ -3211,7 +3211,7 @@ MypyFile:1( [case testParseExtendedSlicing4] m[*index, :] [out] -main:1: error: invalid syntax +main:1: error: Invalid syntax [out version>=3.11] MypyFile:1( ExpressionStmt:1( diff --git a/test-data/unit/semanal-errors.test b/test-data/unit/semanal-errors.test index 52c658c97c3b..fa5cec795931 100644 --- a/test-data/unit/semanal-errors.test +++ b/test-data/unit/semanal-errors.test @@ -361,84 +361,84 @@ main:2: error: "yield" outside function [case testInvalidLvalues1] 1 = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [out version>=3.10] -main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='? +main:1: error: Cannot assign to literal here. Maybe you meant '==' instead of '='? [case testInvalidLvalues2] (1) = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [out version>=3.10] -main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='? +main:1: error: Cannot assign to literal here. Maybe you meant '==' instead of '='? [case testInvalidLvalues3] (1, 1) = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [case testInvalidLvalues4] [1, 1] = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [case testInvalidLvalues6] x = y = z = 1 # ok x, (y, 1) = 1 [out] -main:2: error: cannot assign to literal +main:2: error: Cannot assign to literal [case testInvalidLvalues7] x, [y, 1] = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [case testInvalidLvalues8] x, [y, [z, 1]] = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [case testInvalidLvalues9] x, (y) = 1 # ok x, (y, (z, z)) = 1 # ok x, (y, (z, 1)) = 1 [out] -main:3: error: cannot assign to literal +main:3: error: Cannot assign to literal [case testInvalidLvalues10] x + x = 1 [out] -main:1: error: cannot assign to operator +main:1: error: Cannot assign to operator [out version>=3.10] -main:1: error: cannot assign to expression here. Maybe you meant '==' instead of '='? +main:1: error: Cannot assign to expression here. Maybe you meant '==' instead of '='? [case testInvalidLvalues11] -x = 1 [out] -main:1: error: cannot assign to operator +main:1: error: Cannot assign to operator [out version>=3.10] -main:1: error: cannot assign to expression here. Maybe you meant '==' instead of '='? +main:1: error: Cannot assign to expression here. Maybe you meant '==' instead of '='? [case testInvalidLvalues12] 1.1 = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [out version>=3.10] -main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='? +main:1: error: Cannot assign to literal here. Maybe you meant '==' instead of '='? [case testInvalidLvalues13] 'x' = 1 [out] -main:1: error: cannot assign to literal +main:1: error: Cannot assign to literal [out version>=3.10] -main:1: error: cannot assign to literal here. Maybe you meant '==' instead of '='? +main:1: error: Cannot assign to literal here. Maybe you meant '==' instead of '='? [case testInvalidLvalues14] x() = 1 [out] -main:1: error: cannot assign to function call +main:1: error: Cannot assign to function call [out version>=3.10] -main:1: error: cannot assign to function call here. Maybe you meant '==' instead of '='? +main:1: error: Cannot assign to function call here. Maybe you meant '==' instead of '='? [case testTwoStarExpressions] a, *b, *c = 1 @@ -492,15 +492,15 @@ main:2: error: can't use starred expression here x = 1 del x(1) [out] -main:2: error: cannot delete function call +main:2: error: Cannot delete function call [case testInvalidDel2] x = 1 del x + 1 [out] -main:2: error: cannot delete operator +main:2: error: Cannot delete operator [out version>=3.10] -main:2: error: cannot delete expression +main:2: error: Cannot delete expression [case testInvalidDel3] del z # E: Name "z" is not defined @@ -897,9 +897,9 @@ import typing def f(): pass f() = 1 # type: int [out] -main:3: error: cannot assign to function call +main:3: error: Cannot assign to function call [out version>=3.10] -main:3: error: cannot assign to function call here. Maybe you meant '==' instead of '='? +main:3: error: Cannot assign to function call here. Maybe you meant '==' instead of '='? [case testIndexedAssignmentWithTypeDeclaration] import typing @@ -975,9 +975,9 @@ x, y = 1, 2 # type: int # E: Tuple type expected for multiple variables a = 1 a() = None # type: int [out] -main:2: error: cannot assign to function call +main:2: error: Cannot assign to function call [out version>=3.10] -main:2: error: cannot assign to function call here. Maybe you meant '==' instead of '='? +main:2: error: Cannot assign to function call here. Maybe you meant '==' instead of '='? [case testInvalidLvalueWithExplicitType2] a = 1 @@ -1299,7 +1299,7 @@ main:2: note: Did you forget to import it from "typing"? (Suggestion: "from typi def f(): pass with f() as 1: pass [out] -main:2: error: cannot assign to literal +main:2: error: Cannot assign to literal [case testInvalidTypeAnnotation] import typing @@ -1313,9 +1313,9 @@ import typing def f() -> None: f() = 1 # type: int [out] -main:3: error: cannot assign to function call +main:3: error: Cannot assign to function call [out version>=3.10] -main:3: error: cannot assign to function call here. Maybe you meant '==' instead of '='? +main:3: error: Cannot assign to function call here. Maybe you meant '==' instead of '='? [case testInvalidReferenceToAttributeOfOuterClass] class A: diff --git a/test-data/unit/semanal-statements.test b/test-data/unit/semanal-statements.test index f828e2a3263f..a2e8691733ef 100644 --- a/test-data/unit/semanal-statements.test +++ b/test-data/unit/semanal-statements.test @@ -557,9 +557,9 @@ MypyFile:1( def f(x, y) -> None: del x, y + 1 [out] -main:2: error: cannot delete operator +main:2: error: Cannot delete operator [out version>=3.10] -main:2: error: cannot delete expression +main:2: error: Cannot delete expression [case testTry] class c: pass