Ejemplo n.º 1
0
 def test_bad_pool(self):
     exs = [
         'sto',
         1.1,
         0.5,
         '20',
         [],
         [1,23]
     ]
     for e in exs:
         with self.assertRaises(TypeError):
             Car.get_carpool(e)
         with self.assertRaises(TypeError):
             DieselCar.get_carpool(e)
Ejemplo n.º 2
0
 def test_good_pool(self):
     pools = [
         0,
         1,
         2,
         3,
         10,
         100
     ]
     for nr in pools:
         cp = Car.get_carpool(nr)
         cps = [c.brand for c in cp]
         self.assertEqual(len(cps), nr)
         dp = DieselCar.get_carpool(nr)
         dps = [d.brand for d in dp]
         self.assertEqual(len(dps), nr)
Ejemplo n.º 3
0
 def test_method_pool(self):
     for i in [10,20,30]:
         cars = Car.get_carpool(i)
         for c in cars:
             self.assertEqual(c.fill_tank(limit=0.), 0)
             self.assertEqual(c.fill_tank(liters=0), 0)