diff options
author | Eric Lin <anselor@gmail.com> | 2018-04-14 00:44:32 -0400 |
---|---|---|
committer | Eric Lin <anselor@gmail.com> | 2018-04-14 00:44:32 -0400 |
commit | f6b6a3ce05c47dec6fa7f9c8ab4fc90b9efc6306 (patch) | |
tree | b77efe197f5e8a73bb7df3ff60ff954df77cbf11 /tests/test_completion.py | |
parent | f29d6af523243652fb5854579095f9a6ea5d400f (diff) | |
parent | 9d9e843845b57419e4be1abc65119b1d04dfa0f0 (diff) | |
download | cmd2-git-f6b6a3ce05c47dec6fa7f9c8ab4fc90b9efc6306.tar.gz |
Merge branch 'python3' into autocompleter
Diffstat (limited to 'tests/test_completion.py')
-rw-r--r-- | tests/test_completion.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/tests/test_completion.py b/tests/test_completion.py index a5cec508..f7caf03a 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -341,25 +341,19 @@ def test_path_completion_doesnt_match_wildcards(cmd2_app, request): # Currently path completion doesn't accept wildcards, so will always return empty results assert cmd2_app.path_complete(text, line, begidx, endidx) == [] -def test_path_completion_invalid_syntax(cmd2_app): - # Test a missing separator between a ~ and path - text = '~Desktop' - line = 'shell fake {}'.format(text) - endidx = len(line) - begidx = endidx - len(text) - - assert cmd2_app.path_complete(text, line, begidx, endidx) == [] +def test_path_completion_expand_user_dir(cmd2_app): + # Get the current user. We can't use getpass.getuser() since + # that doesn't work when running these tests on Windows in AppVeyor. + user = os.path.basename(os.path.expanduser('~')) -def test_path_completion_just_tilde(cmd2_app): - # Run path with just a tilde - text = '~' + text = '~{}'.format(user) line = 'shell fake {}'.format(text) endidx = len(line) begidx = endidx - len(text) - completions_tilde = cmd2_app.path_complete(text, line, begidx, endidx) + completions = cmd2_app.path_complete(text, line, begidx, endidx) - # Path complete should complete the tilde with a slash - assert completions_tilde == [text + os.path.sep] + expected = text + os.path.sep + assert expected in completions def test_path_completion_user_expansion(cmd2_app): # Run path with a tilde and a slash |