summaryrefslogtreecommitdiff
path: root/tests/test_cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-13 23:33:58 -0400
committerTodd Leonhardt <todd.leonhardt@gmail.com>2019-03-13 23:33:58 -0400
commit88b45e12b0c2c9e7f8e386504f2d6808f396560b (patch)
tree66209a092dc11528f73a9cb1a991c620be09a815 /tests/test_cmd2.py
parent23fad46d5187600d52b95125bb1629e491cb9e6f (diff)
downloadcmd2-git-88b45e12b0c2c9e7f8e386504f2d6808f396560b.tar.gz
First stage of attribute refactoring
The following are now arguments to cmd2.Cmd.__init__() instead of class attributes: * allow_redirection * multiline_commands * terminators * shortcuts Added a couple read-only properties for convenience of cmd2.Cmd accessing immutable members from self.statement_parser
Diffstat (limited to 'tests/test_cmd2.py')
-rw-r--r--tests/test_cmd2.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/test_cmd2.py b/tests/test_cmd2.py
index b3942203..368ca221 100644
--- a/tests/test_cmd2.py
+++ b/tests/test_cmd2.py
@@ -105,7 +105,7 @@ def test_base_show_readonly(base_app):
Commands may be terminated with: {}
Arguments at invocation allowed: {}
Output redirection and pipes allowed: {}
-""".format(base_app.terminators, base_app.allow_cli_args, base_app.allow_redirection))
+""".format(base_app.statement_parser.terminators, base_app.allow_cli_args, base_app.allow_redirection))
assert out == expected
@@ -557,9 +557,9 @@ def test_feedback_to_output_false(base_app, capsys):
os.remove(filename)
-def test_allow_redirection(base_app):
+def test_disallow_redirection(base_app):
# Set allow_redirection to False
- base_app.allow_redirection = False
+ base_app.statement_parser.allow_redirection = False
filename = 'test_allow_redirect.txt'
@@ -1264,8 +1264,7 @@ def test_which_editor_bad():
class MultilineApp(cmd2.Cmd):
def __init__(self, *args, **kwargs):
- self.multiline_commands = ['orate']
- super().__init__(*args, **kwargs)
+ super().__init__(*args, multiline_commands=['orate'], **kwargs)
orate_parser = argparse.ArgumentParser()
orate_parser.add_argument('-s', '--shout', action="store_true", help="N00B EMULATION MODE")