| 90 | |
| 91 | |
| 92 | def 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 | |
| 108 | def test_stdsim_read_bytes(stdout_sim) -> None: |