コード例 #1
0
    def test_calculate_building(self):
        """should return a dictionary of nested arrays"""

        calc = CodeCalculator(fans=6, floors=2)
        code_dictionary = calc.calculate_building()

        self.assertIsInstance(code_dictionary, dict)
コード例 #2
0
    def test_there_are_no_vertical_collisions(self):
        calc = CodeCalculator(fans=6, floors=3)
        code_dictionary = calc.calculate_building()

        # not wild about hardcoding my indices, ideally
        # I would create a bldg and fl object
        # that is iterable
        higher_floor_index = 1
        lower_floor_index = 2

        while lower_floor_index < len(code_dictionary):
            fan_index = 0
            for fan_code in code_dictionary[f"fl{higher_floor_index}"]:
                print(f"this is the fan index: {fan_index}")
                self.assertNotEqual(
                    fan_code,
                    code_dictionary[f"fl{lower_floor_index}"][fan_index])
                fan_index += 1
            higher_floor_index += 1
            lower_floor_index += 1