File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,7 @@ def test_stdsim_buffer_write_bytes(stdout_sim):
133133 b_str = b'Hello World'
134134 stdout_sim .buffer .write (b_str )
135135 assert stdout_sim .getvalue () == b_str .decode ()
136+ assert stdout_sim .getbytes () == b_str
136137
137138def test_stdsim_buffer_write_str (stdout_sim ):
138139 my_str = 'Hello World'
@@ -148,6 +149,15 @@ def test_stdsim_read(stdout_sim):
148149 assert stdout_sim .read () == my_str
149150 assert stdout_sim .getvalue () == ''
150151
152+ def test_stdsim_read_bytes (stdout_sim ):
153+ b_str = b'Hello World'
154+ stdout_sim .buffer .write (b_str )
155+ # getbytes() returns the value and leaves it unaffected internally
156+ assert stdout_sim .getbytes () == b_str
157+ # read_bytes() returns the value and then clears the internal buffer
158+ assert stdout_sim .readbytes () == b_str
159+ assert stdout_sim .getbytes () == b''
160+
151161def test_stdsim_clear (stdout_sim ):
152162 my_str = 'Hello World'
153163 stdout_sim .write (my_str )
You can’t perform that action at this time.
0 commit comments