summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fstring.py
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-15 17:21:58 (GMT)
committerGitHub <noreply@github.com>2023-06-15 17:21:58 (GMT)
commite9cf5a324e10b693d464692ab19422c40d5e179f (patch)
tree5666230a5f25635afac4ef3552f03203ba876ad5 /Lib/test/test_fstring.py
parentabb4eaa46fc386b0244370c711f0af90c575e27f (diff)
downloadcpython-e9cf5a324e10b693d464692ab19422c40d5e179f.zip
cpython-e9cf5a324e10b693d464692ab19422c40d5e179f.tar.gz
cpython-e9cf5a324e10b693d464692ab19422c40d5e179f.tar.bz2
[3.12] gh-105820: Fix tok_mode expression buffer in file & readline tokenizer (GH-105828) (#105832)
(cherry picked from commit d382ad49157b3802fc5619f68d96810def517869) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Diffstat (limited to 'Lib/test/test_fstring.py')
-rw-r--r--Lib/test/test_fstring.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_fstring.py b/Lib/test/test_fstring.py
index cbb0308..8f6b576 100644
--- a/Lib/test/test_fstring.py
+++ b/Lib/test/test_fstring.py
@@ -15,7 +15,7 @@ import decimal
import unittest
from test import support
from test.support.os_helper import temp_cwd
-from test.support.script_helper import assert_python_failure
+from test.support.script_helper import assert_python_failure, assert_python_ok
a_global = 'global variable'
@@ -1635,5 +1635,18 @@ sdfsdfs{1+
"f'{1=}{1;}'",
])
+ def test_debug_in_file(self):
+ with temp_cwd():
+ script = 'script.py'
+ with open('script.py', 'w') as f:
+ f.write(f"""\
+print(f'''{{
+3
+=}}''')""")
+
+ _, stdout, _ = assert_python_ok(script)
+ self.assertEqual(stdout.decode('utf-8').strip().replace('\r\n', '\n').replace('\r', '\n'),
+ "3\n=3")
+
if __name__ == '__main__':
unittest.main()