diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-23 20:49:27 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-23 20:49:27 -0400 |
commit | 652122f3c9907a652a9c3a14581bb2aef90bc996 (patch) | |
tree | 9bcb0c07c2e2cee26553a1e11a1d9dbcb7225954 /tests | |
parent | 181cecb217dd73056b72874d225e34528d484de8 (diff) | |
download | cmd2-git-652122f3c9907a652a9c3a14581bb2aef90bc996.tar.gz |
Made last_result public and restored the initialization of it in __init__ and associated comment
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cmd2.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py index d4cf7a2a..9a5b2b47 100644 --- a/tests/test_cmd2.py +++ b/tests/test_cmd2.py @@ -1241,16 +1241,16 @@ class CommandResultApp(cmd2.Cmd): super().__init__(*args, **kwargs) def do_affirmative(self, arg): - self._last_result = cmd2.CommandResult(arg, data=True) + self.last_result = cmd2.CommandResult(arg, data=True) def do_negative(self, arg): - self._last_result = cmd2.CommandResult(arg, data=False) + self.last_result = cmd2.CommandResult(arg, data=False) def do_affirmative_no_data(self, arg): - self._last_result = cmd2.CommandResult(arg) + self.last_result = cmd2.CommandResult(arg) def do_negative_no_data(self, arg): - self._last_result = cmd2.CommandResult('', arg) + self.last_result = cmd2.CommandResult('', arg) @pytest.fixture def commandresult_app(): @@ -1260,22 +1260,22 @@ def commandresult_app(): def test_commandresult_truthy(commandresult_app): arg = 'foo' run_cmd(commandresult_app, 'affirmative {}'.format(arg)) - assert commandresult_app._last_result - assert commandresult_app._last_result == cmd2.CommandResult(arg, data=True) + assert commandresult_app.last_result + assert commandresult_app.last_result == cmd2.CommandResult(arg, data=True) run_cmd(commandresult_app, 'affirmative_no_data {}'.format(arg)) - assert commandresult_app._last_result - assert commandresult_app._last_result == cmd2.CommandResult(arg) + assert commandresult_app.last_result + assert commandresult_app.last_result == cmd2.CommandResult(arg) def test_commandresult_falsy(commandresult_app): arg = 'bar' run_cmd(commandresult_app, 'negative {}'.format(arg)) - assert not commandresult_app._last_result - assert commandresult_app._last_result == cmd2.CommandResult(arg, data=False) + assert not commandresult_app.last_result + assert commandresult_app.last_result == cmd2.CommandResult(arg, data=False) run_cmd(commandresult_app, 'negative_no_data {}'.format(arg)) - assert not commandresult_app._last_result - assert commandresult_app._last_result == cmd2.CommandResult('', arg) + assert not commandresult_app.last_result + assert commandresult_app.last_result == cmd2.CommandResult('', arg) def test_is_text_file_bad_input(base_app): |