Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Lib/test/test_fstring.py
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,9 @@ def test_invalid_syntax_error_message(self):
with self.assertRaisesRegex(SyntaxError,
"f-string: expecting '=', or '!', or ':', or '}'"):
compile("f'{a $ b}'", "?", "exec")
with self.assertRaisesRegex(SyntaxError,
"f-string: expecting '!', or ':', or '}'"):
compile("f'{a=b}'", "?", "exec")

def test_with_two_commas_in_format_specifier(self):
error_msg = re.escape("Cannot specify ',' with ','.")
Expand Down
10 changes: 10 additions & 0 deletions Lib/test/test_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,16 @@
Traceback (most recent call last):
SyntaxError: only single target (not list) can be annotated
>>> 1: int
Traceback (most recent call last):
SyntaxError: illegal target for annotation
>>> -x: int = 1
Traceback (most recent call last):
SyntaxError: illegal target for annotation
>>> (x for x in y): int
Traceback (most recent call last):
SyntaxError: illegal target for annotation
# 'not' after operators:
>>> 3 + not 3
Expand Down
14 changes: 14 additions & 0 deletions Lib/test/test_unpack_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,20 @@
^^^
SyntaxError: cannot use dict unpacking in a dictionary value
>>> (**a)
Traceback (most recent call last):
...
(**a)
^^
SyntaxError: cannot use dict unpacking here
>>> {**a for a in {1: 2}.items(): b}
Traceback (most recent call last):
...
{**a for a in {1: 2}.items(): b}
^^
SyntaxError: cannot use dict unpacking here
# Generator expression in function arguments
Expand Down
Loading