returning a list from padfill to cut down on all the str.join ops
This commit is contained in:
parent
998bb596ef
commit
40d222c164
@ -49,7 +49,7 @@ def _padfill(text, pad):
|
|||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
padlines[lineno] = textlines.pop(0) if textlines[1:] else ''
|
padlines[lineno] = textlines.pop(0) if textlines[1:] else ''
|
||||||
return '\n'.join(padlines)
|
return padlines
|
||||||
|
|
||||||
|
|
||||||
def _get_textwidth(text):
|
def _get_textwidth(text):
|
||||||
|
@ -38,10 +38,8 @@ class TestOneTimePad(unittest.TestCase):
|
|||||||
msg = self.msg[:]
|
msg = self.msg[:]
|
||||||
pad = OT.create_pad(len(msg))
|
pad = OT.create_pad(len(msg))
|
||||||
filled = OT._padfill(msg, pad)
|
filled = OT._padfill(msg, pad)
|
||||||
# print filled
|
|
||||||
# raise Exception
|
|
||||||
self.assertTrue(bool(filled))
|
self.assertTrue(bool(filled))
|
||||||
for lineno, line in enumerate(filled.splitlines()):
|
for lineno, line in enumerate(filled):
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if OT._is_cypherline(lineno):
|
if OT._is_cypherline(lineno):
|
||||||
self.assertFalse(bool(len(line)),
|
self.assertFalse(bool(len(line)),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user