Skip to content

Conversation

key262yek
Copy link
Contributor

Update test_fstring.py from CPython v3.12.7

Copy link
Member

@youknowone youknowone left a 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.

@@ -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)
Copy link
Member

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
@key262yek key262yek force-pushed the update_fstring_from_v3.12.7 branch from 164bf6e to 40a9dda Compare December 5, 2024 06:08
Copy link
Contributor Author

@key262yek key262yek left a 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.

Comment on lines +700 to +701
# TODO: RUSTPYTHON SyntaxError
# self.assertEqual(f'{' f'}', " f")
Copy link
Contributor Author

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)

Copy link
Member

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

Comment on lines +761 to +769
# 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",
# )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one also

Comment on lines +839 to +842
# TODO: RUSTPYTHON SyntaxError
# self.assertEqual(
# f"result: {value:{width:{0}}.{precision:1}}", "result: 12.35"
# )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also here

Comment on lines +1089 to +1096
# TODO: RUSTPYTHON SyntaxError
# self.assertEqual(
# f"{(
# 1 +
# 2
# )}",
# "3",
# )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

Comment on lines +1266 to +1277
# 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')
Copy link
Contributor Author

@key262yek key262yek Dec 5, 2024

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

Copy link
Member

@youknowone youknowone left a 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

@youknowone youknowone merged commit 389b20d into RustPython:main Jan 10, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants