summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_pyrepl/test_pyrepl.py
diff options
context:
space:
mode:
authorSergey B Kirpichev <skirpichev@gmail.com>2024-08-22 23:28:09 (GMT)
committerGitHub <noreply@github.com>2024-08-22 23:28:09 (GMT)
commit5271f8feadc198407449514348c34e3fe77de448 (patch)
tree614c3b2f24c16915f09973689146fb5d4a2ff937 /Lib/test/test_pyrepl/test_pyrepl.py
parent5148e03f0f0aa4d2ffabf5df120e359f694d87a5 (diff)
downloadcpython-5271f8feadc198407449514348c34e3fe77de448.zip
cpython-5271f8feadc198407449514348c34e3fe77de448.tar.gz
cpython-5271f8feadc198407449514348c34e3fe77de448.tar.bz2
[3.13] gh-122546: use same filename for different exceptions in new repl (GH-123217) (#123226)
Diffstat (limited to 'Lib/test/test_pyrepl/test_pyrepl.py')
-rw-r--r--Lib/test/test_pyrepl/test_pyrepl.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_pyrepl/test_pyrepl.py b/Lib/test/test_pyrepl/test_pyrepl.py
index d5eafc5..a433212 100644
--- a/Lib/test/test_pyrepl/test_pyrepl.py
+++ b/Lib/test/test_pyrepl/test_pyrepl.py
@@ -1100,6 +1100,16 @@ class TestMain(TestCase):
self.assertIn("spam", output)
self.assertNotEqual(pathlib.Path(hfile.name).stat().st_size, 0)
+ @force_not_colorized
+ def test_correct_filename_in_syntaxerrors(self):
+ env = os.environ.copy()
+ commands = "a b c\nexit()\n"
+ output, exit_code = self.run_repl(commands, env=env)
+ if "can't use pyrepl" in output:
+ self.skipTest("pyrepl not available")
+ self.assertIn("SyntaxError: invalid syntax", output)
+ self.assertIn("<python-input-0>", output)
+
def run_repl(
self,
repl_input: str | list[str],