summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorkotfu <kotfu@kotfu.net>2018-07-05 11:28:40 -0600
committerkotfu <kotfu@kotfu.net>2018-07-05 11:28:40 -0600
commit9a6a2b2c25c19e82c661c7ca602f528312e89a62 (patch)
treee0e330ccfd1e263c69406c6747da1e3bd1568258 /tests
parent985e790c594a2c48804ffa201f9253eb32a59c8b (diff)
parentd80d672f47c3141bf4dfd7fc31818aa36d65a832 (diff)
downloadcmd2-git-9a6a2b2c25c19e82c661c7ca602f528312e89a62.tar.gz
Merge branch 'master' into plugin_functions
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmd2.py27
1 files changed, 14 insertions, 13 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index 26df4807..77dcc875 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -29,7 +29,7 @@ from .conftest import run_cmd, normalize, BASE_HELP, BASE_HELP_VERBOSE, \
def test_ver():
- assert cmd2.__version__ == '0.9.2a'
+ assert cmd2.__version__ == '0.9.3'
def test_empty_statement(base_app):
@@ -1468,32 +1468,33 @@ def test_clipboard_failure(base_app, capsys):
assert "Cannot redirect to paste buffer; install 'pyperclip' and re-run to enable" in err
-class CmdResultApp(cmd2.Cmd):
+class CommandResultApp(cmd2.Cmd):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def do_affirmative(self, arg):
- self._last_result = cmd2.CmdResult(arg)
+ self._last_result = cmd2.CommandResult(arg, data=True)
def do_negative(self, arg):
- self._last_result = cmd2.CmdResult('', arg)
+ self._last_result = cmd2.CommandResult(arg)
@pytest.fixture
-def cmdresult_app():
- app = CmdResultApp()
+def commandresult_app():
+ app = CommandResultApp()
app.stdout = StdOut()
return app
-def test_cmdresult(cmdresult_app):
+def test_commandresult_truthy(commandresult_app):
arg = 'foo'
- run_cmd(cmdresult_app, 'affirmative {}'.format(arg))
- assert cmdresult_app._last_result
- assert cmdresult_app._last_result == cmd2.CmdResult(arg)
+ run_cmd(commandresult_app, 'affirmative {}'.format(arg))
+ assert commandresult_app._last_result
+ assert commandresult_app._last_result == cmd2.CommandResult(arg, data=True)
+def test_commandresult_falsy(commandresult_app):
arg = 'bar'
- run_cmd(cmdresult_app, 'negative {}'.format(arg))
- assert not cmdresult_app._last_result
- assert cmdresult_app._last_result == cmd2.CmdResult('', arg)
+ run_cmd(commandresult_app, 'negative {}'.format(arg))
+ assert not commandresult_app._last_result
+ assert commandresult_app._last_result == cmd2.CommandResult(arg)
def test_is_text_file_bad_input(base_app):