summaryrefslogtreecommitdiff
path: root/Lib/test/test_fstring.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_fstring.py')
-rw-r--r--Lib/test/test_fstring.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index 25730029ae..b39870457a 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -280,6 +280,10 @@ f'{a * x()}'"""
"f'{10:{ }}'",
"f' { } '",
+ # The Python parser ignores also the following
+ # whitespace characters in additional to a space.
+ "f'''{\t\f\r\n}'''",
+
# Catch the empty expression before the
# invalid conversion.
"f'{!x}'",
@@ -300,6 +304,12 @@ f'{a * x()}'"""
"f'{:x'",
])
+ # Different error message is raised for other whitespace characters.
+ self.assertAllRaise(SyntaxError, 'invalid character in identifier',
+ ["f'''{\xa0}'''",
+ "\xa0",
+ ])
+
def test_parens_in_expressions(self):
self.assertEqual(f'{3,}', '(3,)')