예제 #1
0
 def get_engine(self):
     engineAmount = Engine.does_vehicle_have_engine(self.p)
     if engineAmount > 0:
         print("Since this is a " + self.p + ", it contains an engine")
     else:
         print("Since this is a " + self.p +
               ", it does not contain an engine")
예제 #2
0
    def test_engine_start_shutdown(self):

        #create the engine
        engine1 = Engine()

        #test if the engine starts
        self.assertEquals(engine1.start_engine(), "on")

        #test if the engine raises an exception if we try to start a started engine
        self.assertRaises(EngineError, engine1.start_engine)

        #test if the engine shuts down
        self.assertEquals(engine1.shutdown_engine(), "off")

        #test if the engine raises an exception if we try to shutdown a stopped engine
        self.assertRaises(EngineError, engine1.shutdown_engine)
예제 #3
0
    def test_engine_start_shutdown(self):

        #create the engine
        engine1 = Engine()

        #test if the engine starts
        self.assertEquals(engine1.start_engine(), "on")

        #test if the engine raises an exception if we try to start a started engine
        self.assertRaises(EngineError, engine1.start_engine)

        #test if the engine shuts down
        self.assertEquals(engine1.shutdown_engine(), "off")

        #test if the engine raises an exception if we try to shutdown a stopped engine
        self.assertRaises(EngineError, engine1.shutdown_engine)
예제 #4
0
 def test_start_car(self):
     car1 = car.Car("Random Car", [Wheel(16.5) for i in range(4)], Engine(),
                    Body(16.5, 12.6))
     self.assertTrue(car1.start_car())
예제 #5
0
 def test_does_vehicle_have_engine(self):
     print("have_engine test. ")
     test = Engine()
     car = "car"
     if self.assertEqual(test.does_vehicle_have_engine(car), 1):
         return
예제 #6
0
 def get_engine(self):
     return Engine()
예제 #7
0
 def getEngine(self):
     engine = Engine()
     engine.horsepower = 4000
     return engine