Skip to content

Commit b43e3d9

Browse files
committed
Added additional unit test for StdSim
1 parent e7a11bd commit b43e3d9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_utils.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,23 @@ def stdout_sim():
119119
stdsim = cu.StdSim(sys.stdout)
120120
return stdsim
121121

122+
@pytest.fixture
123+
def stringio_sim():
124+
import io
125+
stdsim = cu.StdSim(io.StringIO(), echo=True)
126+
return stdsim
127+
128+
122129
def test_stdsim_write_str(stdout_sim):
123130
my_str = 'Hello World'
124131
stdout_sim.write(my_str)
125132
assert stdout_sim.getvalue() == my_str
126133

134+
def test_stdsim_write_str_inner_no_buffer(stringio_sim):
135+
my_str = 'Hello World'
136+
stringio_sim.write(my_str)
137+
assert stringio_sim.getvalue() == my_str
138+
127139
def test_stdsim_write_bytes(stdout_sim):
128140
b_str = b'Hello World'
129141
with pytest.raises(TypeError):

0 commit comments

Comments
 (0)