summaryrefslogtreecommitdiff
path: root/tests/test_autocompletion.py
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2018-04-20 15:50:53 -0400
committerEric Lin <anselor@gmail.com>2018-04-20 15:50:53 -0400
commit85c2c6bba46900af6012b54c31e650095194b1aa (patch)
tree4519d86d44f5c40376a820f530b69fa2ee745de3 /tests/test_autocompletion.py
parenta0a46f9396a72f440f65e46d7170a0d366796574 (diff)
downloadcmd2-git-85c2c6bba46900af6012b54c31e650095194b1aa.tar.gz
Changed cmd2 to use autocompleter by default for all argparse commands. Not all tests are passing yet.
Diffstat (limited to 'tests/test_autocompletion.py')
-rw-r--r--tests/test_autocompletion.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_autocompletion.py b/tests/test_autocompletion.py
index e68bc104..1d0c9678 100644
--- a/tests/test_autocompletion.py
+++ b/tests/test_autocompletion.py
@@ -213,6 +213,27 @@ def test_autocomp_subcmd_flag_comp_list(cmd2_app):
assert first_match is not None and first_match == '"Gareth Edwards'
+def test_autocomp_subcmd_flag_comp_func_attr(cmd2_app):
+ text = 'A'
+ line = 'video movies list -a "{}'.format(text)
+ endidx = len(line)
+ begidx = endidx - len(text)
+
+ first_match = complete_tester(text, line, begidx, endidx, cmd2_app)
+ assert first_match is not None and \
+ cmd2_app.completion_matches == ['Adam Driver', 'Alec Guinness', 'Andy Serkis', 'Anthony Daniels']
+
+
+def test_autocomp_subcmd_flag_comp_list_attr(cmd2_app):
+ text = 'G'
+ line = 'video movies list -d {}'.format(text)
+ endidx = len(line)
+ begidx = endidx - len(text)
+
+ first_match = complete_tester(text, line, begidx, endidx, cmd2_app)
+ assert first_match is not None and first_match == '"Gareth Edwards'
+
+
def test_autcomp_pos_consumed(cmd2_app):
text = ''
line = 'library movie add SW_EP01 {}'.format(text)
@@ -254,3 +275,5 @@ def test_autcomp_custom_func_list_and_dict_arg(cmd2_app):
first_match = complete_tester(text, line, begidx, endidx, cmd2_app)
assert first_match is not None and \
cmd2_app.completion_matches == ['S01E02', 'S01E03', 'S02E01', 'S02E03']
+
+