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

Function test_multiline_history_added

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

Source from the content-addressed store, hash-verified

1920
1921
1922def test_multiline_history_added(multiline_app, monkeypatch) -> None:
1923 # Test that multiline commands are added to history as a single item
1924 run_cmd(multiline_app, "history --clear")
1925
1926 read_command_mock = mock.MagicMock(name="_read_command_line", side_effect=["person", "\n"])
1927 monkeypatch.setattr("cmd2.Cmd._read_command_line", read_command_mock)
1928
1929 # run_cmd calls onecmd_plus_hooks which triggers history addition
1930 run_cmd(multiline_app, "orate hi")
1931
1932 assert len(multiline_app.history) == 1
1933 assert multiline_app.history.get(1).raw == "orate hi\nperson\n\n"
1934
1935
1936def test_multiline_history_with_quotes(multiline_app, monkeypatch) -> None:

Callers

nothing calls this directly

Calls 2

run_cmdFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…