diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | tests/test_bashcompletion.py | 12 | ||||
-rw-r--r-- | tests/test_transcript.py | 10 |
3 files changed, 12 insertions, 11 deletions
@@ -12,6 +12,7 @@ cmd2.egg-info # Code Coverage .coverage htmlcov +junit # PyCharm .idea diff --git a/tests/test_bashcompletion.py b/tests/test_bashcompletion.py index c7201e4b..b99c3fea 100644 --- a/tests/test_bashcompletion.py +++ b/tests/test_bashcompletion.py @@ -124,13 +124,13 @@ def my_fdopen(fd, mode, *args): # noinspection PyShadowingNames @pytest.mark.skipif(skip_no_argcomplete or skip_windows, reason=skip_reason) -def test_invalid_ifs(parser1, mock): +def test_invalid_ifs(parser1, mocker): completer = CompletionFinder() - mock.patch.dict(os.environ, {'_ARGCOMPLETE': '1', + mocker.patch.dict(os.environ, {'_ARGCOMPLETE': '1', '_ARGCOMPLETE_IFS': '\013\013'}) - mock.patch.object(os, 'fdopen', my_fdopen) + mocker.patch.object(os, 'fdopen', my_fdopen) with pytest.raises(SystemExit): completer(parser1, AutoCompleter(parser1), exit_method=sys.exit) @@ -178,16 +178,16 @@ def fdopen_fail_8(fd, mode, *args): # noinspection PyShadowingNames @pytest.mark.skipif(skip_no_argcomplete or skip_windows, reason=skip_reason) -def test_fail_alt_stdout(parser1, mock): +def test_fail_alt_stdout(parser1, mocker): completer = CompletionFinder() comp_line = 'media movies list ' - mock.patch.dict(os.environ, {'_ARGCOMPLETE': '1', + mocker.patch.dict(os.environ, {'_ARGCOMPLETE': '1', '_ARGCOMPLETE_IFS': '\013', 'COMP_TYPE': '63', 'COMP_LINE': comp_line, 'COMP_POINT': str(len(comp_line))}) - mock.patch.object(os, 'fdopen', fdopen_fail_8) + mocker.patch.object(os, 'fdopen', fdopen_fail_8) try: choices = {'actor': query_actors, # function diff --git a/tests/test_transcript.py b/tests/test_transcript.py index 6f1c4be0..d7438e86 100644 --- a/tests/test_transcript.py +++ b/tests/test_transcript.py @@ -200,15 +200,15 @@ this is a \/multiline\/ command ( '/tmp is nice', re.escape('/tmp is nice') ), ( 'slash at end/', re.escape('slash at end/') ), # escaped slashes - ( 'not this slash\/ or this one\/', re.escape('not this slash/ or this one/' ) ), + ( r'not this slash\/ or this one\/', re.escape('not this slash/ or this one/' ) ), # regexes ( '/.*/', '.*' ), ( 'specials ^ and + /[0-9]+/', re.escape('specials ^ and + ') + '[0-9]+' ), - ( '/a{6}/ but not \/a{6} with /.*?/ more', 'a{6}' + re.escape(' but not /a{6} with ') + '.*?' + re.escape(' more') ), - ( 'not \/, use /\|?/, not \/', re.escape('not /, use ') + '\|?' + re.escape(', not /') ), + ( r'/a{6}/ but not \/a{6} with /.*?/ more', 'a{6}' + re.escape(' but not /a{6} with ') + '.*?' + re.escape(' more') ), + ( r'not \/, use /\|?/, not \/', re.escape('not /, use ') + r'\|?' + re.escape(', not /') ), # inception: slashes in our regex. backslashed on input, bare on output - ( 'not \/, use /\/?/, not \/', re.escape('not /, use ') + '/?' + re.escape(', not /') ), - ( 'lots /\/?/ more /.*/ stuff', re.escape('lots ') + '/?' + re.escape(' more ') + '.*' + re.escape(' stuff') ), + ( r'not \/, use /\/?/, not \/', re.escape('not /, use ') + '/?' + re.escape(', not /') ), + ( r'lots /\/?/ more /.*/ stuff', re.escape('lots ') + '/?' + re.escape(' more ') + '.*' + re.escape(' stuff') ), ]) def test_parse_transcript_expected(expected, transformed): app = CmdLineApp() |