Exemplo n.º 1
0
    def test_init_add_car(self):
        garage1 = Garage(rnd_town(), 1)
        garage2 = Garage(rnd_town(), 2)
        cesar = Cesar(rnd_name(), [garage1])

        car1 = Car(rnd_float(), rnd_car_type(), rnd_car_producer(),
                   rnd_float())
        car2 = Car(rnd_float(), rnd_car_type(), rnd_car_producer(),
                   rnd_float())
        car3 = Car(rnd_float(), rnd_car_type(), rnd_car_producer(),
                   rnd_float())

        cesar.add_car(car1, garage1)
        cesar.add_car(car2, garage2)
        cesar.add_car(car3, garage2)

        self.assertEqual(cesar.register_id, garage1.owner)
        self.assertEqual(cesar.register_id, garage2.owner)

        self.assertEqual(garage1.cars_count(), 1)
        self.assertEqual(garage2.cars_count(), 2)

        self.assertTrue(car1.number in garage1.cars)
        self.assertTrue(car2.number in garage2.cars)
        self.assertTrue(car3.number in garage2.cars)
Exemplo n.º 2
0
    def test_cars_count(self):
        car1 = Car(rnd_float(), rnd_car_type(), rnd_car_producer(),
                   rnd_float())
        car2 = Car(rnd_float(), rnd_car_type(), rnd_car_producer(),
                   rnd_float())
        garage = Garage(rnd_town(), rnd_int(), rnd_uuid(), [car1, car2])

        self.assertEqual(garage.cars_count(), 2)