diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-10-09 19:12:24 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-10-09 19:12:24 -0400 |
commit | b43e3d94c00da2a9865bf7861025814e8848c620 (patch) | |
tree | 4c09044327abbd81cba1c85d89ab3e3b48c44b85 /tests/test_utils.py | |
parent | e7a11bdb96ba259d6dd6302ac053a6e4c78aea07 (diff) | |
download | cmd2-git-b43e3d94c00da2a9865bf7861025814e8848c620.tar.gz |
Added additional unit test for StdSim
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py index 43a05a9a..807bc0fd 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -119,11 +119,23 @@ def stdout_sim(): stdsim = cu.StdSim(sys.stdout) return stdsim +@pytest.fixture +def stringio_sim(): + import io + stdsim = cu.StdSim(io.StringIO(), echo=True) + return stdsim + + def test_stdsim_write_str(stdout_sim): my_str = 'Hello World' stdout_sim.write(my_str) assert stdout_sim.getvalue() == my_str +def test_stdsim_write_str_inner_no_buffer(stringio_sim): + my_str = 'Hello World' + stringio_sim.write(my_str) + assert stringio_sim.getvalue() == my_str + def test_stdsim_write_bytes(stdout_sim): b_str = b'Hello World' with pytest.raises(TypeError): |