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

Function test_multiline_complete_statement_keyboard_interrupt

tests/test_cmd2.py:4302–4314  ·  view source on GitHub ↗
(multiline_app, monkeypatch)

Source from the content-addressed store, hash-verified

4300
4301
4302def test_multiline_complete_statement_keyboard_interrupt(multiline_app, monkeypatch):
4303 # Mock _read_command_line to raise KeyboardInterrupt
4304 read_command_mock = mock.MagicMock(name="_read_command_line", side_effect=KeyboardInterrupt)
4305 monkeypatch.setattr("cmd2.Cmd._read_command_line", read_command_mock)
4306
4307 # Mock poutput to verify ^C is printed
4308 poutput_mock = mock.MagicMock(name="poutput")
4309 monkeypatch.setattr(multiline_app, "poutput", poutput_mock)
4310
4311 with pytest.raises(exceptions.EmptyStatement):
4312 multiline_app._complete_statement("orate incomplete")
4313
4314 poutput_mock.assert_called_with("^C")
4315
4316
4317def test_create_main_session_no_console_error(monkeypatch):

Callers

nothing calls this directly

Calls 1

_complete_statementMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…