summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unparse.py
diff options
context:
space:
mode:
authorShantanu <12621235+hauntsaninja@users.noreply.github.com>2025-01-31 08:49:06 (GMT)
committerGitHub <noreply@github.com>2025-01-31 08:49:06 (GMT)
commit8df5193d37f70a1478642c4b456dcc7d6df6c117 (patch)
treee81c499c63bab25018ac819ba7b67cbb123220a6 /Lib/test/test_unparse.py
parent95504f429eec04010d0b815345ebcc3af2402af0 (diff)
downloadcpython-8df5193d37f70a1478642c4b456dcc7d6df6c117.zip
cpython-8df5193d37f70a1478642c4b456dcc7d6df6c117.tar.gz
cpython-8df5193d37f70a1478642c4b456dcc7d6df6c117.tar.bz2
gh-127975: Avoid reusing quote types in ast.unparse if not needed (#127980)
Diffstat (limited to 'Lib/test/test_unparse.py')
-rw-r--r--Lib/test/test_unparse.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_unparse.py b/Lib/test/test_unparse.py
index 3329195..f6c4f1f 100644
--- a/Lib/test/test_unparse.py
+++ b/Lib/test/test_unparse.py
@@ -513,11 +513,13 @@ class CosmeticTestCase(ASTTestCase):
self.check_src_roundtrip("class X(*args, **kwargs):\n pass")
def test_fstrings(self):
- self.check_src_roundtrip("f'-{f'*{f'+{f'.{x}.'}+'}*'}-'")
- self.check_src_roundtrip("f'\\u2028{'x'}'")
+ self.check_src_roundtrip('''f\'\'\'-{f"""*{f"+{f'.{x}.'}+"}*"""}-\'\'\'''')
+ self.check_src_roundtrip('''f\'-{f\'\'\'*{f"""+{f".{f'{x}'}."}+"""}*\'\'\'}-\'''')
+ self.check_src_roundtrip('''f\'-{f\'*{f\'\'\'+{f""".{f"{f'{x}'}"}."""}+\'\'\'}*\'}-\'''')
+ self.check_src_roundtrip('''f"\\u2028{'x'}"''')
self.check_src_roundtrip(r"f'{x}\n'")
- self.check_src_roundtrip("f'{'\\n'}\\n'")
- self.check_src_roundtrip("f'{f'{x}\\n'}\\n'")
+ self.check_src_roundtrip('''f"{'\\n'}\\n"''')
+ self.check_src_roundtrip('''f"{f'{x}\\n'}\\n"''')
def test_docstrings(self):
docstrings = (