Sha256: 12751ec3c9f17821df566cfbd09dc04474f57c7a98438371441f004662f993d7

Contents?: true

Size: 1.03 KB

Versions: 73

Compression:

Stored size: 1.03 KB

Contents

import unittest

from crypto_square import encode


# Tests adapted from `problem-specifications//canonical-data.json` @ v3.2.0

class CryptoSquareTest(unittest.TestCase):
    def test_empty_string(self):
        self.assertEqual(encode(''), '')

    def test_lowercase(self):
        self.assertEqual(encode('A'), 'a')

    def test_remove_spaces(self):
        self.assertEqual(encode('  b '), 'b')

    def test_remove_punctuation(self):
        self.assertEqual(encode('@1,%!'), '1')

    def test_9chars_results_3chunks(self):
        self.assertEqual(encode('This is fun!'), 'tsf hiu isn')

    def test_8chars_results_3chunks_ending_space(self):
        self.assertEqual(encode('Chill out.'), 'clu hlt io ')

    def test_54chars_results_7chunks_2ending_space(self):
        self.assertEqual(
            encode('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()

Version data entries

73 entries across 73 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.158 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.157 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.156 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.155 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.154 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.153 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.152 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.151 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.150 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.149 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.148 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.147 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.146 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.145 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.144 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.143 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.142 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.141 tracks/python/exercises/crypto-square/crypto_square_test.py
trackler-2.2.1.140 tracks/python/exercises/crypto-square/crypto_square_test.py