Coverage for car.py: 100%
11 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-09 21:08 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-09 21:08 +0000
1"""Defines the Car class."""
2from serviceable import Serviceable
3from engine.base_engine import Engine
4from battery.base_battery import Battery
5from tire.base_tire import Tire
7class Car(Serviceable):
8 """Creates a Car object.
10 The Car object is composed of an Engine, Battery and Tire.
12 Usage:
13 engine = Engine_type(......)
14 battery = Battery_type(......)
15 tire = Tire_type(......)
16 car_instance = Car(engine, battery, tire, ...)
17 """
18 def __init__(self, engine: Engine, battery: Battery, tire: Tire = None):
19 self.engine = engine
20 self.battery = battery
21 self.tire = tire
23 def needs_service(self) -> bool:
24 """Check if Car needs to be serviced
25 The fucntion checks the service status of each of
26 the components to determine if the car needs service
27 """
28 return self.engine.needs_service() or self.battery.needs_service()