mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-108843: fix ast.unparse for f-string with many quotes (#108981)
This commit is contained in:
parent
4dd47c63a9
commit
23f9f6f464
3 changed files with 35 additions and 1 deletions
|
@ -635,6 +635,20 @@ class CosmeticTestCase(ASTTestCase):
|
|||
self.check_src_roundtrip("[a, b] = [c, d] = [e, f] = g")
|
||||
self.check_src_roundtrip("a, b = [c, d] = e, f = g")
|
||||
|
||||
def test_multiquote_joined_string(self):
|
||||
self.check_ast_roundtrip("f\"'''{1}\\\"\\\"\\\"\" ")
|
||||
self.check_ast_roundtrip("""f"'''{1}""\\"" """)
|
||||
self.check_ast_roundtrip("""f'""\"{1}''' """)
|
||||
self.check_ast_roundtrip("""f'""\"{1}""\\"' """)
|
||||
|
||||
self.check_ast_roundtrip("""f"'''{"\\n"}""\\"" """)
|
||||
self.check_ast_roundtrip("""f'""\"{"\\n"}''' """)
|
||||
self.check_ast_roundtrip("""f'""\"{"\\n"}""\\"' """)
|
||||
|
||||
self.check_ast_roundtrip("""f'''""\"''\\'{"\\n"}''' """)
|
||||
self.check_ast_roundtrip("""f'''""\"''\\'{"\\n\\"'"}''' """)
|
||||
self.check_ast_roundtrip("""f'''""\"''\\'{""\"\\n\\"'''""\" '''\\n'''}''' """)
|
||||
|
||||
|
||||
class ManualASTCreationTestCase(unittest.TestCase):
|
||||
"""Test that AST nodes created without a type_params field unparse correctly."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue