(multiline_app, monkeypatch)
| 1955 | |
| 1956 | |
| 1957 | def test_multiline_complete_statement_eof(multiline_app, monkeypatch): |
| 1958 | # Mock poutput to verify it's called |
| 1959 | poutput_mock = mock.MagicMock(name="poutput") |
| 1960 | monkeypatch.setattr(multiline_app, "poutput", poutput_mock) |
| 1961 | |
| 1962 | read_raw_mock = mock.MagicMock(name="_read_raw_input", side_effect=EOFError) |
| 1963 | monkeypatch.setattr("cmd2.Cmd._read_raw_input", read_raw_mock) |
| 1964 | |
| 1965 | command = "orate" |
| 1966 | args = "hello world" |
| 1967 | line = f"{command} {args}" |
| 1968 | |
| 1969 | # This should call _read_command_line, get 'eof', set nextline to '\n', |
| 1970 | # and then parse the line with the newline terminator. |
| 1971 | statement = multiline_app._complete_statement(line) |
| 1972 | |
| 1973 | assert statement.command == command |
| 1974 | assert statement.args == args |
| 1975 | assert statement.terminator == "\n" |
| 1976 | |
| 1977 | # Verify that poutput('\n') was called |
| 1978 | poutput_mock.assert_called_once_with("\n") |
| 1979 | |
| 1980 | |
| 1981 | class CommandResultApp(cmd2.Cmd): |
nothing calls this directly
no test coverage detected
searching dependent graphs…