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

Function test_stdsim_read

tests/test_utils.py:92–105  ·  view source on GitHub ↗
(stdout_sim)

Source from the content-addressed store, hash-verified

90
91
92def test_stdsim_read(stdout_sim) -> None:
93 my_str = "Hello World"
94 stdout_sim.write(my_str)
95 # getvalue() returns the value and leaves it unaffected internally
96 assert stdout_sim.getvalue() == my_str
97 # read() returns the value and then clears the internal buffer
98 assert stdout_sim.read() == my_str
99 assert stdout_sim.getvalue() == ""
100
101 stdout_sim.write(my_str)
102
103 assert stdout_sim.getvalue() == my_str
104 assert stdout_sim.read(2) == my_str[:2]
105 assert stdout_sim.getvalue() == my_str[2:]
106
107
108def test_stdsim_read_bytes(stdout_sim) -> None:

Callers

nothing calls this directly

Calls 3

getvalueMethod · 0.80
readMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…