Skip to content

Commit ff1d2b0

Browse files
committed
Add test
1 parent 83a838c commit ff1d2b0

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎Lib/test/test_pyrepl/test_reader.py‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,19 +480,20 @@ def _test_error_message(
480480
*,
481481
command: str | None = None,
482482
binding: str | None = None,
483+
error_count: int = 1,
483484
**reader_kwargs,
484485
):
485486
console = prepare_console(code_to_events(keys))
486487
reader = prepare_reader(console, **reader_kwargs)
487488
if command is not None:
488489
reader.bind(binding or keys, command)
489490

490-
while not reader.msg:
491+
while console.beep.call_count < error_count:
491492
reader.handle1()
492493

493494
self.assertEqual(reader.msg, f"! {expected}")
494495
self.assertEqual(reader.screen[-1], f"! {expected}")
495-
console.beep.assert_called_once()
496+
self.assertEqual(console.beep.call_count, error_count)
496497

497498
def test_invalid_key_message(self):
498499
self._test_error_message("\x1bo", "no command is bound to this key")
@@ -516,6 +517,13 @@ def test_yank_pop_after_other_command_message(self):
516517
"previous command was not a yank",
517518
)
518519

520+
def test_yank_pop_after_failed_yank_pop_message(self):
521+
self._test_error_message(
522+
"x\x01\x0b\x1by\x1by",
523+
"previous command was not a yank",
524+
error_count=2,
525+
)
526+
519527
def test_start_of_history_message(self):
520528
self._test_error_message("\x10", "start of history list")
521529

0 commit comments

Comments
 (0)