Esempio n. 1
0
    def test_places_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(), 5, rnd_uuid(), [car1, car2])

        self.assertEqual(garage.places_count(), 3)
Esempio n. 2
0
    def test_init_add_car_emptiest_garage(self):
        garage1 = Garage(rnd_town(), 1, rnd_uuid())
        garage2 = Garage(rnd_town(), 2, rnd_uuid())
        garage3 = Garage(rnd_town(), 3, rnd_uuid())
        cesar = Cesar(rnd_name(), [garage1, garage2, garage3])

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

        cesar.add_car(car1)
        self.assertEqual(garage1.places_count(), 1)
        self.assertEqual(garage2.places_count(), 2)
        self.assertEqual(garage3.places_count(), 2)

        cesar.add_car(car2)
        self.assertEqual(garage1.places_count(), 1)
        self.assertEqual(garage2.places_count(), 1)
        self.assertEqual(garage3.places_count(), 2)