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.140 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.139 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.138 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.137 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.136 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.135 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.134 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.133 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.132 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.131 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.130 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.129 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.128 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.127 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.126 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.125 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.124 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.123 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.122 tracks/python/exercises/etl/etl_test.py
trackler-2.2.1.121 tracks/python/exercises/etl/etl_test.py