| 2203 | |
| 2204 | |
| 2205 | def test_custom_stdout() -> None: |
| 2206 | # Create a custom file-like object (e.g., an in-memory string buffer) |
| 2207 | custom_output = io.StringIO() |
| 2208 | |
| 2209 | # Instantiate cmd2.Cmd with the custom_output as stdout |
| 2210 | my_app = cmd2.Cmd(stdout=custom_output) |
| 2211 | |
| 2212 | # Simulate a command |
| 2213 | my_app.onecmd("help") |
| 2214 | |
| 2215 | # Retrieve the output from the custom_output buffer |
| 2216 | captured_output = custom_output.getvalue() |
| 2217 | assert "history" in captured_output |
| 2218 | |
| 2219 | |
| 2220 | def test_read_command_line_eof(base_app, monkeypatch) -> None: |