s/cypher/cipher/g ... (sigh) I must have been sleepy :P

cat-town
Dan Buch 15 years ago
parent 40d222c164
commit 8cf3df0e3e

@ -45,7 +45,7 @@ def _padfill(text, pad):
padlines = pad.splitlines() padlines = pad.splitlines()
textlines = _chunk_chars_into_lines(text, _get_textwidth(pad)) textlines = _chunk_chars_into_lines(text, _get_textwidth(pad))
for lineno, padline in enumerate(padlines[:]): for lineno, padline in enumerate(padlines[:]):
if _is_padline(lineno) or _is_cypherline(lineno): if _is_padline(lineno) or _is_cipherline(lineno):
continue continue
else: else:
padlines[lineno] = textlines.pop(0) if textlines[1:] else '' padlines[lineno] = textlines.pop(0) if textlines[1:] else ''
@ -64,8 +64,8 @@ def _is_txtline(lineno):
return (lineno % 2 and not lineno % 3) return (lineno % 2 and not lineno % 3)
def _is_cypherline(lineno): def _is_cipherline(lineno):
return lineno % 3 return lineno % PAD_MODULO
def _mk_as_alpha(): def _mk_as_alpha():

@ -28,9 +28,9 @@ class TestOneTimePad(unittest.TestCase):
elif OT._is_txtline(lineno): elif OT._is_txtline(lineno):
self.assertFalse(bool(len(line)), self.assertFalse(bool(len(line)),
'text line {0} is empty'.format(lineno)) 'text line {0} is empty'.format(lineno))
elif OT._is_cypherline(lineno): elif OT._is_cipherline(lineno):
self.assertFalse(bool(len(line)), self.assertFalse(bool(len(line)),
'cypher line {0} is empty'.format(lineno)) 'cipher line {0} is empty'.format(lineno))
else: else:
raise NotImplementedError(lineno) raise NotImplementedError(lineno)
@ -41,7 +41,7 @@ class TestOneTimePad(unittest.TestCase):
self.assertTrue(bool(filled)) self.assertTrue(bool(filled))
for lineno, line in enumerate(filled): for lineno, line in enumerate(filled):
line = line.strip() line = line.strip()
if OT._is_cypherline(lineno): if OT._is_cipherline(lineno):
self.assertFalse(bool(len(line)), self.assertFalse(bool(len(line)),
'line {0} is empty'.format(lineno)) 'line {0} is empty'.format(lineno))
elif OT._is_txtline(lineno): elif OT._is_txtline(lineno):

Loading…
Cancel
Save