diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-24 10:10:36 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2018-09-24 10:10:36 -0400 |
commit | 0bf2824bcb9c00ee56dde660b432990fc0df22f4 (patch) | |
tree | d6589102bb8044ef9a03b4f6ac36ed63951b9329 | |
parent | ca4ac5cfe4fae041463674cd8ee40b62444693f8 (diff) | |
download | cmd2-git-0bf2824bcb9c00ee56dde660b432990fc0df22f4.tar.gz |
Added a couple more unit tests for StdStim
-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 12d87218..53031567 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -154,3 +154,15 @@ def test_stdsim_clear(stdout_sim): assert stdout_sim.getvalue() == my_str stdout_sim.clear() assert stdout_sim.getvalue() == '' + +def test_stdsim_getattr_exist(stdout_sim): + # Here the StdSim getattr is allowing us to access methods within StdSim + my_str = 'Hello World' + stdout_sim.write(my_str) + val_func = getattr(stdout_sim, 'getvalue') + assert val_func() == my_str + +def test_stdsim_getattr_noexist(stdout_sim): + # Here the StdSim getattr is allowing us to access methods defined by the inner stream + assert not stdout_sim.isatty() + |