mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Make an f-string error message more exact and consistent.
This commit is contained in:
parent
13a6d2834a
commit
09835dcdbb
2 changed files with 3 additions and 2 deletions
|
@ -182,9 +182,10 @@ f'{a * x()}'"""
|
|||
self.assertEqual(f'{"#"}', '#')
|
||||
self.assertEqual(f'{d["#"]}', 'hash')
|
||||
|
||||
self.assertAllRaise(SyntaxError, "f-string cannot include '#'",
|
||||
self.assertAllRaise(SyntaxError, "f-string expression part cannot include '#'",
|
||||
["f'{1#}'", # error because the expression becomes "(1#)"
|
||||
"f'{3(#)}'",
|
||||
"f'{#}'",
|
||||
])
|
||||
|
||||
def test_many_expressions(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue