Skip to content

Commit 316e6db

Browse files
Add starter for test function
1 parent 4cdb3ae commit 316e6db

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_pyrepl/test_pyrepl.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,3 +1327,17 @@ def test_readline_history_file(self):
13271327
def test_keyboard_interrupt_after_isearch(self):
13281328
output, exit_code = self.run_repl(["\x12", "\x03", "exit"])
13291329
self.assertEqual(exit_code, 0)
1330+
1331+
def test_prompt_after_help(self):
1332+
# Ensure that we don't see a double prompt after exiting `help`
1333+
output, exit_code = self.run_repl(["help", "q", "exit"])
1334+
1335+
# Regex pattern to remove ANSI escape sequences
1336+
ansi_escape = re.compile(r"(\x9B|\x1B\[)[0-?]*[ -\/]*[@-~]")
1337+
1338+
# Remove ANSI escape codes from the string
1339+
cleaned_output = ansi_escape.sub("", output)
1340+
1341+
self.assertEqual(exit_code, 0)
1342+
self.assertRegex(cleaned_output, r"(?<!>>> )>>>\s*$")
1343+

0 commit comments

Comments
 (0)