mirror of
https://github.com/Xevion/exercism.git
synced 2025-12-06 07:14:56 -06:00
python crypto square
This commit is contained in:
36
python/crypto-square/crypto_square_test.py
Normal file
36
python/crypto-square/crypto_square_test.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import unittest
|
||||
|
||||
from crypto_square import cipher_text
|
||||
|
||||
|
||||
# Tests adapted from `problem-specifications//canonical-data.json` @ v3.2.0
|
||||
|
||||
class CryptoSquareTest(unittest.TestCase):
|
||||
def test_empty_string(self):
|
||||
self.assertEqual(cipher_text(''), '')
|
||||
|
||||
def test_lowercase(self):
|
||||
self.assertEqual(cipher_text('A'), 'a')
|
||||
|
||||
def test_remove_spaces(self):
|
||||
self.assertEqual(cipher_text(' b '), 'b')
|
||||
|
||||
def test_remove_punctuation(self):
|
||||
self.assertEqual(cipher_text('@1,%!'), '1')
|
||||
|
||||
def test_9chars_results_3chunks(self):
|
||||
self.assertEqual(cipher_text('This is fun!'), 'tsf hiu isn')
|
||||
|
||||
def test_8chars_results_3chunks_ending_space(self):
|
||||
self.assertEqual(cipher_text('Chill out.'), 'clu hlt io ')
|
||||
|
||||
def test_54chars_results_7chunks_2ending_space(self):
|
||||
self.assertEqual(
|
||||
cipher_text('If man was meant to stay on the ground, '
|
||||
'god would have given us roots.'),
|
||||
'imtgdvs fearwer mayoogo anouuio ntnnlvt wttddes aohghn sseoau '
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user