mirror of
https://github.com/python/cpython.git
synced 2025-11-10 02:21:40 +00:00
[3.13] gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485) (#129155)
gh-123024: Correctly prepare/restore around help and show-history commands (GH-124485)
(cherry picked from commit 5a9afe2362)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Emily Morehouse <emily@cuttlesoft.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
3048dcd15a
commit
0ddcb61ffe
7 changed files with 77 additions and 57 deletions
|
|
@ -1344,3 +1344,16 @@ def test_readline_history_file(self):
|
|||
def test_keyboard_interrupt_after_isearch(self):
|
||||
output, exit_code = self.run_repl(["\x12", "\x03", "exit"])
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
def test_prompt_after_help(self):
|
||||
output, exit_code = self.run_repl(["help", "q", "exit"])
|
||||
|
||||
# Regex pattern to remove ANSI escape sequences
|
||||
ansi_escape = re.compile(r"(\x1B(=|>|(\[)[0-?]*[ -\/]*[@-~]))")
|
||||
cleaned_output = ansi_escape.sub("", output)
|
||||
self.assertEqual(exit_code, 0)
|
||||
|
||||
# Ensure that we don't see multiple prompts after exiting `help`
|
||||
# Extra stuff (newline and `exit` rewrites) are necessary
|
||||
# because of how run_repl works.
|
||||
self.assertNotIn(">>> \n>>> >>>", cleaned_output)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue