-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Update fstring from v3.12.7 #5444
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update fstring from v3.12.7 #5444
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing. Updating test_fstring seems a big task.
Please check the comment and other commented out test codes too to fit failing tests to our preference.
Lib/test/test_fstring.py
Outdated
@@ -329,13 +334,13 @@ def test_ast_line_numbers_multiline_fstring(self): | |||
self.assertEqual(t.body[1].lineno, 3) | |||
self.assertEqual(t.body[1].value.lineno, 3) | |||
self.assertEqual(t.body[1].value.values[0].lineno, 3) | |||
self.assertEqual(t.body[1].value.values[1].lineno, 3) | |||
self.assertEqual(t.body[1].value.values[2].lineno, 3) | |||
# TODO: RUSTPYTHON self.assertEqual(t.body[1].value.values[1].lineno, 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we usually do not comment out test lines, but turn off the test itself.
Could you revert this part and mark test_ast_line_numbers_multiline_fstring
as expectedFailure?
add expectedFailure to tag what should rustpython do add comment for some syntaxerror which make test run broken
164bf6e
to
40a9dda
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still struggle with rebase..
I made new branch with same name.
I remove comment from test, but some lines cannot be un-commented because of SyntaxError.
# TODO: RUSTPYTHON SyntaxError | ||
# self.assertEqual(f'{' f'}', " f") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't remove some comments, because it makes SyntaxError before test runs (so it cannot be passed by expectedFailure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense. Thank you
# TODO: RUSTPYTHON SyntaxError | ||
# self.assertEqual( | ||
# f""" | ||
# # this is not a comment | ||
# { # the following operation it's | ||
# 3 # this is a number | ||
# * 2}""", | ||
# "\n# this is not a comment\n6", | ||
# ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one also
# TODO: RUSTPYTHON SyntaxError | ||
# self.assertEqual( | ||
# f"result: {value:{width:{0}}.{precision:1}}", "result: 12.35" | ||
# ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also here
# TODO: RUSTPYTHON SyntaxError | ||
# self.assertEqual( | ||
# f"{( | ||
# 1 + | ||
# 2 | ||
# )}", | ||
# "3", | ||
# ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
# TODO: RUSTPYTHON SyntaxError | ||
# def test_expressions_with_triple_quoted_strings(self): | ||
# self.assertEqual(f"{'''x'''}", 'x') | ||
# self.assertEqual(f"{'''eric's'''}", "eric's") | ||
|
||
# Test concatenation within an expression | ||
# TODO: RUSTPYTHON self.assertEqual(f'{"x" """eric"s""" "y"}', 'xeric"sy') | ||
# TODO: RUSTPYTHON self.assertEqual(f'{"x" """eric"s"""}', 'xeric"s') | ||
# TODO: RUSTPYTHON self.assertEqual(f'{"""eric"s""" "y"}', 'eric"sy') | ||
# TODO: RUSTPYTHON self.assertEqual(f'{"""x""" """eric"s""" "y"}', 'xeric"sy') | ||
# TODO: RUSTPYTHON self.assertEqual(f'{"""x""" """eric"s""" """y"""}', 'xeric"sy') | ||
# TODO: RUSTPYTHON self.assertEqual(f'{r"""x""" """eric"s""" """y"""}', 'xeric"sy') | ||
# # Test concatenation within an expression | ||
# self.assertEqual(f'{"x" """eric"s""" "y"}', 'xeric"sy') | ||
# self.assertEqual(f'{"x" """eric"s"""}', 'xeric"s') | ||
# self.assertEqual(f'{"""eric"s""" "y"}', 'eric"sy') | ||
# self.assertEqual(f'{"""x""" """eric"s""" "y"}', 'xeric"sy') | ||
# self.assertEqual(f'{"""x""" """eric"s""" """y"""}', 'xeric"sy') | ||
# self.assertEqual(f'{r"""x""" """eric"s""" """y"""}', 'xeric"sy') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this part is the reason why I commented line by line of broken assertion at first.
Only one assertion can be run, and others make SyntaxError
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets go with it. We can fix it once parser is changed
Update test_fstring.py from CPython v3.12.7