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

Function test_custom_stdout

tests/test_cmd2.py:2205–2217  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2203
2204
2205def 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
2220def test_read_command_line_eof(base_app, monkeypatch) -> None:

Callers

nothing calls this directly

Calls 2

onecmdMethod · 0.95
getvalueMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…