diff options
author | Eric Lin <anselor@gmail.com> | 2018-04-19 12:13:32 -0400 |
---|---|---|
committer | Eric Lin <anselor@gmail.com> | 2018-04-19 12:13:32 -0400 |
commit | c2186332aeb6f59063bb410fca25ed400ce410cd (patch) | |
tree | ccc1d07fcf14f81c6e06d3b9dddcf141f96dcdd2 /tests/test_completion.py | |
parent | ff66a95f399330bfca5b7f3b4dcd18b457574ac4 (diff) | |
download | cmd2-git-c2186332aeb6f59063bb410fca25ed400ce410cd.tar.gz |
Addresses comments on #362
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index 2902f55e..a01d1166 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -863,6 +863,7 @@ def test_subcommand_tab_completion(sc_app): # It is at end of line, so extra space is present assert first_match is not None and sc_app.completion_matches == ['Football '] + def test_subcommand_tab_completion_with_no_completer(sc_app): # This tests what happens when a subcommand has no completer # In this case, the foo subcommand has no completer defined @@ -874,6 +875,7 @@ def test_subcommand_tab_completion_with_no_completer(sc_app): first_match = complete_tester(text, line, begidx, endidx, sc_app) assert first_match is None + def test_subcommand_tab_completion_space_in_text(sc_app): text = 'B' line = 'base sport "Space {}'.format(text) @@ -886,10 +888,6 @@ def test_subcommand_tab_completion_space_in_text(sc_app): sc_app.completion_matches == ['Ball" '] and \ sc_app.display_matches == ['Space Ball'] - - - - #################################################### @@ -960,6 +958,7 @@ class SubcommandsWithUnknownExample(cmd2.Cmd): @pytest.fixture def scu_app(): + """Declare test fixture for with_argparser_and_unknown_args""" app = SubcommandsWithUnknownExample() return app @@ -975,6 +974,7 @@ def test_cmd2_subcmd_with_unknown_completion_single_end(scu_app): # It is at end of line, so extra space is present assert first_match is not None and scu_app.completion_matches == ['foo '] + def test_cmd2_subcmd_with_unknown_completion_multiple(scu_app): text = '' line = 'base {}'.format(text) @@ -984,6 +984,7 @@ def test_cmd2_subcmd_with_unknown_completion_multiple(scu_app): first_match = complete_tester(text, line, begidx, endidx, scu_app) assert first_match is not None and scu_app.completion_matches == ['bar', 'foo', 'sport'] + def test_cmd2_subcmd_with_unknown_completion_nomatch(scu_app): text = 'z' line = 'base {}'.format(text) @@ -1001,6 +1002,7 @@ def test_cmd2_help_subcommand_completion_single(scu_app): begidx = endidx - len(text) assert scu_app.complete_help(text, line, begidx, endidx) == ['base'] + def test_cmd2_help_subcommand_completion_multiple(scu_app): text = '' line = 'help base {}'.format(text) @@ -1018,6 +1020,7 @@ def test_cmd2_help_subcommand_completion_nomatch(scu_app): begidx = endidx - len(text) assert scu_app.complete_help(text, line, begidx, endidx) == [] + def test_subcommand_tab_completion(scu_app): # This makes sure the correct completer for the sport subcommand is called text = 'Foot' @@ -1030,6 +1033,7 @@ def test_subcommand_tab_completion(scu_app): # It is at end of line, so extra space is present assert first_match is not None and scu_app.completion_matches == ['Football '] + def test_subcommand_tab_completion_with_no_completer(scu_app): # This tests what happens when a subcommand has no completer # In this case, the foo subcommand has no completer defined @@ -1041,6 +1045,7 @@ def test_subcommand_tab_completion_with_no_completer(scu_app): first_match = complete_tester(text, line, begidx, endidx, scu_app) assert first_match is None + def test_subcommand_tab_completion_space_in_text(scu_app): text = 'B' line = 'base sport "Space {}'.format(text) @@ -1053,19 +1058,9 @@ def test_subcommand_tab_completion_space_in_text(scu_app): scu_app.completion_matches == ['Ball" '] and \ scu_app.display_matches == ['Space Ball'] - - #################################################### - - - - - - - - class SecondLevel(cmd2.Cmd): """To be used as a second level command class. """ |