| 1733 | |
| 1734 | |
| 1735 | def test_select_ctrl_c(outsim_app, monkeypatch) -> None: |
| 1736 | # Ctrl-C during select prints ^C and raises a KeyboardInterrupt |
| 1737 | read_input_mock = mock.MagicMock(name="read_input", side_effect=KeyboardInterrupt) |
| 1738 | monkeypatch.setattr("cmd2.Cmd.read_input", read_input_mock) |
| 1739 | |
| 1740 | with pytest.raises(KeyboardInterrupt): |
| 1741 | outsim_app.select([("Guitar", "Electric Guitar"), ("Drums",)], "Instrument? ") |
| 1742 | |
| 1743 | out = outsim_app.stdout.getvalue() |
| 1744 | assert out.rstrip().endswith("^C") |
| 1745 | |
| 1746 | |
| 1747 | def test_select_choice_tty(outsim_app, monkeypatch) -> None: |