returning a list from padfill to cut down on all the str.join ops

This commit is contained in:
Dan Buch 2009-11-26 08:30:33 -05:00
parent 998bb596ef
commit 40d222c164
2 changed files with 2 additions and 4 deletions

View File

@ -49,7 +49,7 @@ def _padfill(text, pad):
continue
else:
padlines[lineno] = textlines.pop(0) if textlines[1:] else ''
return '\n'.join(padlines)
return padlines
def _get_textwidth(text):

View File

@ -38,10 +38,8 @@ class TestOneTimePad(unittest.TestCase):
msg = self.msg[:]
pad = OT.create_pad(len(msg))
filled = OT._padfill(msg, pad)
# print filled
# raise Exception
self.assertTrue(bool(filled))
for lineno, line in enumerate(filled.splitlines()):
for lineno, line in enumerate(filled):
line = line.strip()
if OT._is_cypherline(lineno):
self.assertFalse(bool(len(line)),