MCPcopy Index your code
hub / github.com/python-cmd2/cmd2 / test_select_ctrl_c

Function test_select_ctrl_c

tests/test_cmd2.py:1735–1744  ·  view source on GitHub ↗
(outsim_app, monkeypatch)

Source from the content-addressed store, hash-verified

1733
1734
1735def 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
1747def test_select_choice_tty(outsim_app, monkeypatch) -> None:

Callers

nothing calls this directly

Calls 2

selectMethod · 0.80
getvalueMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…