def test_get_roof_square(self): actual_res = self.house.get_roof_square() expected_res = 60 assert actual_res == expected_res house_with_other_roof = House() house_with_other_roof.create_roof(10, 6, "gable") actual_res = house_with_other_roof.get_roof_square() expected_res = 120 assert actual_res == expected_res
def test_get_count_and_sum_of_windows(self): window = House() window.create_window(2, 1) self.assertEqual(1, window.get_count_of_windows()) self.assertEqual(2, window.get_windows_square()) with self.assertRaises(ValueError): window.create_window(0, 0)
def setup_class(cls): cls.house = House() cls.house.create_wall(10, 2.5) cls.house.create_wall(10, 2.5) cls.house.create_wall(14, 2.5) cls.house.create_wall(14, 2.5) cls.house.create_roof(10, 6, "single-pitch") cls.house.create_door(1, 2) cls.house.create_window(3, 1)
def test_get_door_square(self): door = House() result = [4] door_h_w = [2] split = zip(door_h_w, result) for d, res in split: door.create_door(d, d) self.assertEqual(res, door.get_door_square()) for d in split: result.append(5) door_h_w.append(5) with self.assertRaises(ValueError): door.create_door(d, d)
def test_zero_wall(self): with pytest.raises(ValueError): zero_house = House() zero_house.create_wall(0, 0)
def test_number_of_rolls_of_wallpapers(self): wall = House() self.assertEqual(4.75, wall.get_number_of_rolls_of_wallpapers(2, 4))
def test_roof_square(self): roof = House() roof.create_roof(2, 2, "gable") self.assertEqual(8, roof.get_roof_square())
def test_update_metal_price(self): price = House() price.create_door(2, 2) price.update_metal_price(15) self.assertEqual(60, price.get_door_price("metal"))
def test_update_wood_price(self): price = House() price.create_door(2, 2) price.update_wood_price(40) self.assertEqual(160, price.get_door_price("wood"))
def test_get_door_price(self): price = House() price.create_door(2, 2) self.assertEqual(40, price.get_door_price("wood"))
def test_get_count_and_sum_of_walls(self): wall = House() wall_meter = [wall.create_wall(2, 2), wall.create_wall(2, 3), wall.create_wall(5, 2), wall.create_wall(5, 5)] self.assertEqual(4, wall.get_count_of_walls()) self.assertEqual(45, wall.get_walls_square())
def setUp(self) -> None: self.house = [ House(), ]