summaryrefslogtreecommitdiff
path: root/tests/test_transcript.py
diff options
context:
space:
mode:
authorJared Crapo <jared@kotfu.net>2017-08-21 18:30:07 -0600
committerJared Crapo <jared@kotfu.net>2017-08-21 18:30:07 -0600
commitd3766eb29f728b5e9d60645bbbac9062c683870e (patch)
tree19d8a2e93694fbef44f40bac03e946c54cf0fa2e /tests/test_transcript.py
parent560133d0c95845e0b573d70303fc96d999c52c03 (diff)
downloadcmd2-git-d3766eb29f728b5e9d60645bbbac9062c683870e.tar.gz
Checkpoint. Many tests working, multiline seems broken
Diffstat (limited to 'tests/test_transcript.py')
-rw-r--r--tests/test_transcript.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/test_transcript.py b/tests/test_transcript.py
index fef28c7b..caa5174d 100644
--- a/tests/test_transcript.py
+++ b/tests/test_transcript.py
@@ -256,7 +256,8 @@ def test_invalid_syntax(_cmdline_app, capsys):
('spaces.txt', False),
])
def test_transcript(request, capsys, filename, feedback_to_output):
- # Create a cmd2.Cmd() instance and make sure basic settings are like we want for test
+ # Create a cmd2.Cmd() instance and make sure basic settings are
+ # like we want for test
app = CmdLineApp()
app.feedback_to_output = feedback_to_output
@@ -264,7 +265,8 @@ def test_transcript(request, capsys, filename, feedback_to_output):
test_dir = os.path.dirname(request.module.__file__)
transcript_file = os.path.join(test_dir, 'transcripts', filename)
- # Need to patch sys.argv so cmd2 doesn't think it was called with arguments equal to the py.test args
+ # Need to patch sys.argv so cmd2 doesn't think it was called with
+ # arguments equal to the py.test args
testargs = ['prog', '-t', transcript_file]
with mock.patch.object(sys, 'argv', testargs):
# Run the command loop
@@ -288,6 +290,11 @@ def test_transcript(request, capsys, filename, feedback_to_output):
( '/.*/', '.*'),
( 'specials ^ and + /[0-9]+/', 'specials\ \^\ and\ \+\ [0-9]+'),
( '/a{6}/ but not a{6} with /.*?/ more', 'a{6}\ but\ not\ a\{6\}\ with\ .*?\ more'),
+ ( 'not this slash\/ or this one\/', 'not\ this\ slash\\/\ or\ this\ one\\/'),
+ ( 'not \/, use /\|?/, not \/', 'not\ \\/\,\ use\ \|?\,\ not\ \\/'),
+ # inception: we have a slashes in our regex: backslashed on input, bare on output
+ ( 'not \/, use /\/?/, not \/', 'not\ \\/\,\ use\ /?\,\ not\ \\/'),
+ ( 'the /\/?/ more /.*/ stuff', 'the\ /?\ more\ .*\ stuff')
])
def test_parse_transcript_expected(expected, transformed):
app = CmdLineApp()
@@ -296,6 +303,4 @@ def test_parse_transcript_expected(expected, transformed):
cmdapp = app
testcase = TestMyAppCase()
-
assert testcase._transform_transcript_expected(expected) == transformed
-