Sha256: 54a2960cdef326d952cce70ca07eb43cae06213468b18ebb0e6ad8a79ea203d6

Contents?: true

Size: 1.41 KB

Versions: 114

Compression:

Stored size: 1.41 KB

Contents

import unittest

from etl import transform


# Tests adapted from `problem-specifications//canonical-data.json` @ v1.0.0

class TransformTest(unittest.TestCase):
    def test_a_single_letter(self):
        self.assertEqual(transform({1: ['A']}), {'a': 1})

    def test_single_score_with_multiple_letters(self):
        legacy_data = {1: ["A", "E", "I", "O", "U"]}
        data = {"a": 1, "e": 1, "i": 1, "o": 1, "u": 1}
        self.assertEqual(transform(legacy_data), data)

    def test_multiple_scores_with_multiple_letters(self):
        legacy_data = {1: ["A", "E"], 2: ["D", "G"]}
        data = {"a": 1, "d": 2, "e": 1, "g": 2}
        self.assertEqual(transform(legacy_data), data)

    def test_multiple_scores_with_differing_numbers_of_letters(self):
        legacy_data = {
            1: ["A", "E", "I", "O", "U", "L", "N", "R", "S", "T"],
            2: ["D", "G"],
            3: ["B", "C", "M", "P"],
            4: ["F", "H", "V", "W", "Y"],
            5: ["K"],
            8: ["J", "X"],
            10: ["Q", "Z"]
        }
        data = {
            "a": 1, "b": 3, "c": 3, "d": 2, "e": 1, "f": 4,
            "g": 2, "h": 4, "i": 1, "j": 8, "k": 5, "l": 1,
            "m": 3, "n": 1, "o": 1, "p": 3, "q": 10, "r": 1,
            "s": 1, "t": 1, "u": 1, "v": 4, "w": 4, "x": 8,
            "y": 4, "z": 10
        }
        self.assertEqual(transform(legacy_data), data)


if __name__ == '__main__':
    unittest.main()

Version data entries

114 entries across 114 versions & 1 rubygems

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