diff options
Diffstat (limited to 'Lib/test/test_syntax.py')
-rw-r--r-- | Lib/test/test_syntax.py | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Lib/test/test_syntax.py b/Lib/test/test_syntax.py index 75b778d20e9..4d8198e5db6 100644 --- a/Lib/test/test_syntax.py +++ b/Lib/test/test_syntax.py @@ -248,22 +248,36 @@ SyntaxError: did you forget parentheses around the comprehension target? # Missing commas in literals collections should not # produce special error messages regarding missing -# parentheses +# parentheses, but about missing commas instead >>> [1, 2 3] Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax. Perhaps you forgot a comma? >>> {1, 2 3} Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax. Perhaps you forgot a comma? >>> {1:2, 2:5 3:12} Traceback (most recent call last): -SyntaxError: invalid syntax +SyntaxError: invalid syntax. Perhaps you forgot a comma? >>> (1, 2 3) Traceback (most recent call last): +SyntaxError: invalid syntax. Perhaps you forgot a comma? + +# Make sure soft keywords constructs don't raise specialized +# errors regarding missing commas + +>>> match x: +... y = 3 +Traceback (most recent call last): +SyntaxError: invalid syntax + +>>> match x: +... case y: +... 3 $ 3 +Traceback (most recent call last): SyntaxError: invalid syntax From compiler_complex_args(): @@ -864,7 +878,7 @@ leading to spurious errors. SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='? Ensure that early = are not matched by the parser as invalid comparisons - >>> f(2, 4, x=34); {1,2 a} + >>> f(2, 4, x=34); 1 $ 2 Traceback (most recent call last): SyntaxError: invalid syntax |