Skip to content

Commit c816b0b

Browse files
committed
Tag test_fstring failing tests as expectedFailure
1 parent 8dfab08 commit c816b0b

File tree

1 file changed

+61
-11
lines changed

1 file changed

+61
-11
lines changed

Lib/test/test_fstring.py

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ def __call__(self):
8383
# Make sure x was called.
8484
self.assertTrue(x.called)
8585

86+
# TODO: RUSTPYTHON - binop lineno
87+
@unittest.expectedFailure
8688
def test_ast_line_numbers(self):
8789
expr = """
8890
a = 10
@@ -114,6 +116,8 @@ def test_ast_line_numbers(self):
114116
self.assertEqual(binop.left.col_offset, 3)
115117
self.assertEqual(binop.right.col_offset, 7)
116118

119+
# TODO: RUSTPYTHON binops lineno and col_offset
120+
@unittest.expectedFailure
117121
def test_ast_line_numbers_multiple_formattedvalues(self):
118122
expr = """
119123
f'no formatted values'
@@ -166,6 +170,8 @@ def test_ast_line_numbers_multiple_formattedvalues(self):
166170
self.assertEqual(binop2.left.col_offset, 23)
167171
self.assertEqual(binop2.right.col_offset, 27)
168172

173+
# TODO: RUSTPYTHON binops lineno and col_offset
174+
@unittest.expectedFailure
169175
def test_ast_line_numbers_nested(self):
170176
expr = """
171177
a = 10
@@ -211,6 +217,8 @@ def test_ast_line_numbers_nested(self):
211217
self.assertEqual(call.lineno, 3)
212218
self.assertEqual(call.col_offset, 11)
213219

220+
# TODO: RUSTPYTHON binops lineno and col_offset
221+
@unittest.expectedFailure
214222
def test_ast_line_numbers_duplicate_expression(self):
215223
expr = """
216224
a = 10
@@ -277,6 +285,8 @@ def test_ast_line_numbers_duplicate_expression(self):
277285
self.assertEqual(binop.left.col_offset, 23)
278286
self.assertEqual(binop.right.col_offset, 27)
279287

288+
# TODO: RUSTPYTHON err col_offset and missing end_* attributes
289+
@unittest.expectedFailure
280290
def test_ast_numbers_fstring_with_formatting(self):
281291

282292
t = ast.parse('f"Here is that pesky {xxx:.3f} again"')
@@ -300,6 +310,8 @@ def test_ast_numbers_fstring_with_formatting(self):
300310
self.assertEqual(name.col_offset, 22)
301311
self.assertEqual(name.end_col_offset, 25)
302312

313+
# TODO: RUSTPYTHON col_offset and binop lineno and col_offset
314+
@unittest.expectedFailure
303315
def test_ast_line_numbers_multiline_fstring(self):
304316
# See bpo-30465 for details.
305317
expr = """
@@ -379,6 +391,8 @@ def test_ast_line_numbers_multiline_fstring(self):
379391
self.assertEqual(t.body[0].value.values[1].value.col_offset, 11)
380392
self.assertEqual(t.body[0].value.values[1].value.end_col_offset, 16)
381393

394+
# TODO: RUSTPYTHON lineno, col_offset, end*
395+
@unittest.expectedFailure
382396
def test_ast_line_numbers_with_parentheses(self):
383397
expr = """
384398
x = (
@@ -432,6 +446,8 @@ def test_ast_line_numbers_with_parentheses(self):
432446
self.assertEqual(wat2.col_offset, 12)
433447
self.assertEqual(wat2.end_col_offset, 18)
434448

449+
# TODO: RUSTPYTHON
450+
@unittest.expectedFailure
435451
def test_docstring(self):
436452
def f():
437453
f'''Not a docstring'''
@@ -454,6 +470,8 @@ def test_ast_compile_time_concat(self):
454470
exec(c)
455471
self.assertEqual(x[0], 'foo3')
456472

473+
# TODO: RUSTPYTHON
474+
@unittest.expectedFailure
457475
def test_compile_time_concat_errors(self):
458476
self.assertAllRaise(SyntaxError,
459477
'cannot mix bytes and nonbytes literals',
@@ -563,6 +581,8 @@ def test_compile_time_concat(self):
563581
["f'{3' f'}'", # can't concat to get a valid f-string
564582
])
565583

584+
# TODO: RUSTPYTHON
585+
@unittest.expectedFailure
566586
def test_comments(self):
567587
# These aren't comments, since they're in strings.
568588
d = {'#': 'hash'}
@@ -652,6 +672,8 @@ def __format__(self, spec):
652672
x = X()
653673
self.assertEqual(f'{x} {x}', '1 2')
654674

675+
# TODO: RUSTPYTHON
676+
@unittest.expectedFailure
655677
def test_missing_expression(self):
656678
self.assertAllRaise(SyntaxError, 'f-string: empty expression not allowed',
657679
["f'{}'",
@@ -692,6 +714,8 @@ def test_missing_expression(self):
692714
"\xa0",
693715
])
694716

717+
# TODO: RUSTPYTHON
718+
@unittest.expectedFailure
695719
def test_parens_in_expressions(self):
696720
self.assertEqual(f'{3,}', '(3,)')
697721

@@ -715,6 +739,8 @@ def test_newlines_before_syntax_error(self):
715739
self.assertAllRaise(SyntaxError, "invalid syntax",
716740
["f'{.}'", "\nf'{.}'", "\n\nf'{.}'"])
717741

742+
# TODO: RUSTPYTHON
743+
@unittest.expectedFailure
718744
def test_backslashes_in_string_part(self):
719745
self.assertEqual(f'\t', '\t')
720746
self.assertEqual(r'\t', '\\t')
@@ -770,6 +796,8 @@ def test_backslashes_in_string_part(self):
770796
self.assertEqual(fr'\N{AMPERSAND}', '\\Nspam')
771797
self.assertEqual(f'\\\N{AMPERSAND}', '\\&')
772798

799+
# TODO: RUSTPYTHON
800+
@unittest.expectedFailure
773801
def test_misformed_unicode_character_name(self):
774802
# These test are needed because unicode names are parsed
775803
# differently inside f-strings.
@@ -789,6 +817,8 @@ def test_misformed_unicode_character_name(self):
789817
r"'\N{GREEK CAPITAL LETTER DELTA'",
790818
])
791819

820+
# TODO: RUSTPYTHON
821+
@unittest.expectedFailure
792822
def test_no_backslashes_in_expression_part(self):
793823
self.assertAllRaise(SyntaxError, 'f-string expression part cannot include a backslash',
794824
[r"f'{\'a\'}'",
@@ -806,10 +836,10 @@ def test_no_escapes_for_braces(self):
806836
Only literal curly braces begin an expression.
807837
"""
808838
# \x7b is '{'.
809-
self.assertEqual(f'\x7b1+1}}', '{1+1}')
810-
self.assertEqual(f'\x7b1+1', '{1+1')
811-
self.assertEqual(f'\u007b1+1', '{1+1')
812-
self.assertEqual(f'\N{LEFT CURLY BRACKET}1+1\N{RIGHT CURLY BRACKET}', '{1+1}')
839+
# TODO: RUSTPYTHON self.assertEqual(f'\x7b1+1}}', '{1+1}')
840+
# TODO: RUSTPYTHON self.assertEqual(f'\x7b1+1', '{1+1')
841+
# TODO: RUSTPYTHON self.assertEqual(f'\u007b1+1', '{1+1')
842+
# TODO: RUSTPYTHON self.assertEqual(f'\N{LEFT CURLY BRACKET}1+1\N{RIGHT CURLY BRACKET}', '{1+1}')
813843

814844
def test_newlines_in_expressions(self):
815845
self.assertEqual(f'{0}', '0')
@@ -850,15 +880,15 @@ def fn(x):
850880

851881
def test_expressions_with_triple_quoted_strings(self):
852882
self.assertEqual(f"{'''x'''}", 'x')
853-
self.assertEqual(f"{'''eric's'''}", "eric's")
883+
# TODO: RUSTPYTHON self.assertEqual(f"{'''eric's'''}", "eric's")
854884

855885
# Test concatenation within an expression
856-
self.assertEqual(f'{"x" """eric"s""" "y"}', 'xeric"sy')
857-
self.assertEqual(f'{"x" """eric"s"""}', 'xeric"s')
858-
self.assertEqual(f'{"""eric"s""" "y"}', 'eric"sy')
859-
self.assertEqual(f'{"""x""" """eric"s""" "y"}', 'xeric"sy')
860-
self.assertEqual(f'{"""x""" """eric"s""" """y"""}', 'xeric"sy')
861-
self.assertEqual(f'{r"""x""" """eric"s""" """y"""}', 'xeric"sy')
886+
# TODO: RUSTPYTHON self.assertEqual(f'{"x" """eric"s""" "y"}', 'xeric"sy')
887+
# TODO: RUSTPYTHON self.assertEqual(f'{"x" """eric"s"""}', 'xeric"s')
888+
# TODO: RUSTPYTHON self.assertEqual(f'{"""eric"s""" "y"}', 'eric"sy')
889+
# TODO: RUSTPYTHON self.assertEqual(f'{"""x""" """eric"s""" "y"}', 'xeric"sy')
890+
# TODO: RUSTPYTHON self.assertEqual(f'{"""x""" """eric"s""" """y"""}', 'xeric"sy')
891+
# TODO: RUSTPYTHON self.assertEqual(f'{r"""x""" """eric"s""" """y"""}', 'xeric"sy')
862892

863893
def test_multiple_vars(self):
864894
x = 98
@@ -991,6 +1021,8 @@ def test_leading_trailing_spaces(self):
9911021
self.assertEqual(f'expr={ {x: y for x, y in [(1, 2), ]} }',
9921022
'expr={1: 2}')
9931023

1024+
# TODO: RUSTPYTHON string should be cut at 3 chars
1025+
@unittest.expectedFailure
9941026
def test_not_equal(self):
9951027
# There's a special test for this because there's a special
9961028
# case in the f-string parser to look for != as not ending an
@@ -1053,6 +1085,8 @@ def test_del(self):
10531085
"del '' f''",
10541086
])
10551087

1088+
# TODO: RUSTPYTHON
1089+
@unittest.expectedFailure
10561090
def test_mismatched_braces(self):
10571091
self.assertAllRaise(SyntaxError, "f-string: single '}' is not allowed",
10581092
["f'{{}'",
@@ -1138,6 +1172,8 @@ def test_empty_format_specifier(self):
11381172
self.assertEqual(f'{x!s:}', 'test')
11391173
self.assertEqual(f'{x!r:}', "'test'")
11401174

1175+
# TODO: RUSTPYTHON d[0] error
1176+
@unittest.expectedFailure
11411177
def test_str_format_differences(self):
11421178
d = {'a': 'string',
11431179
0: 'integer',
@@ -1149,6 +1185,8 @@ def test_str_format_differences(self):
11491185
self.assertEqual('{d[a]}'.format(d=d), 'string')
11501186
self.assertEqual('{d[0]}'.format(d=d), 'integer')
11511187

1188+
# TODO: RUSTPYTHON
1189+
@unittest.expectedFailure
11521190
def test_errors(self):
11531191
# see issue 26287
11541192
self.assertAllRaise(TypeError, 'unsupported',
@@ -1160,6 +1198,8 @@ def test_errors(self):
11601198
r"f'{1000:j}'",
11611199
])
11621200

1201+
# TODO: RUSTPYTHON
1202+
@unittest.expectedFailure
11631203
def test_filename_in_syntaxerror(self):
11641204
# see issue 38964
11651205
with temp_cwd() as cwd:
@@ -1305,25 +1345,35 @@ def test_walrus(self):
13051345
self.assertEqual(f'{(x:=10)}', '10')
13061346
self.assertEqual(x, 10)
13071347

1348+
# TODO: RUSTPYTHON
1349+
@unittest.expectedFailure
13081350
def test_invalid_syntax_error_message(self):
13091351
with self.assertRaisesRegex(SyntaxError, "f-string: invalid syntax"):
13101352
compile("f'{a $ b}'", "?", "exec")
13111353

1354+
# TODO: RUSTPYTHON
1355+
@unittest.expectedFailure
13121356
def test_with_two_commas_in_format_specifier(self):
13131357
error_msg = re.escape("Cannot specify ',' with ','.")
13141358
with self.assertRaisesRegex(ValueError, error_msg):
13151359
f'{1:,,}'
13161360

1361+
# TODO: RUSTPYTHON
1362+
@unittest.expectedFailure
13171363
def test_with_two_underscore_in_format_specifier(self):
13181364
error_msg = re.escape("Cannot specify '_' with '_'.")
13191365
with self.assertRaisesRegex(ValueError, error_msg):
13201366
f'{1:__}'
13211367

1368+
# TODO: RUSTPYTHON
1369+
@unittest.expectedFailure
13221370
def test_with_a_commas_and_an_underscore_in_format_specifier(self):
13231371
error_msg = re.escape("Cannot specify both ',' and '_'.")
13241372
with self.assertRaisesRegex(ValueError, error_msg):
13251373
f'{1:,_}'
13261374

1375+
# TODO: RUSTPYTHON
1376+
@unittest.expectedFailure
13271377
def test_with_an_underscore_and_a_comma_in_format_specifier(self):
13281378
error_msg = re.escape("Cannot specify both ',' and '_'.")
13291379
with self.assertRaisesRegex(ValueError, error_msg):

0 commit comments

Comments
 (0)