Mercurial > python-cmd2
diff cmd2.py @ 176:645467c0d3f9
cleanup unused code
author | catherine@dellzilla |
---|---|
date | Fri, 12 Dec 2008 15:29:28 -0500 |
parents | 72de7d8566e2 |
children | f2b1643b5173 |
line wrap: on
line diff
--- a/cmd2.py Fri Dec 12 15:27:42 2008 -0500 +++ b/cmd2.py Fri Dec 12 15:29:28 2008 -0500 @@ -874,16 +874,6 @@ def tearDown(self): sys.stdout = self.old_stdout -class Transcript(object): - def __init__(self, cmdapp, filename='test_cmd2.txt'): - self.cmdapp = cmdapp - try: - tfile = open(filename) - self.transcript = tfile.readlines() - tfile.close() - except IOError: - self.transcript = [] - class Cmd2TestCase(unittest.TestCase): '''Subclass this, setting CmdApp and transcriptFileName, to make a unittest.TestCase class that will execute the commands in transcriptFileName and expect the results shown. @@ -903,25 +893,6 @@ def divideTranscript(self): self.dialogue = [] commandStart = None - responseStart = None - prompt = self.cmdapp.prompt.rstrip() - continuationPrompt = self.cmdapp.continuationPrompt.rstrip() - for (lineNum, line) in enumerate(self.transcript): - if line.startswith(prompt): - if commandStart == lineNum - 1: - responseStart = lineNum - if responseStart is not None: - self.dialogue.append((commandStart, ''.join(command), ''.join(self.transcript[responseStart:lineNum]))) - command = [line[len(prompt)+1:]] - commandStart = lineNum - elif line.startswith(continuationPrompt): - command.append(line[len(continuationPrompt)+1:]) - else: - if responseStart < commandStart: - responseStart = lineNum - def divideTranscript(self): - self.dialogue = [] - commandStart = None response = [] command = [] prompt = self.cmdapp.prompt.rstrip()