Coverage for engine/willoughby_engine.py: 100%
10 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"""This module defines a specilised engine named WilloughbyEngine.
2"""
3from engine.base_engine import Engine
4from utils.input_validator import validate_int
7class WilloughbyEngine(Engine):
8 """Creates WilloughbyEngine objects.
10 Inherits from the Engine class.
12 methods:
13 needs_serviced: Determines if the engine should be serviced.
14 """
15 def __init__(self, current_mileage: int,
16 last_service_mileage: int):
17 """Initializes WilloughbyEngine objects."""
19 # validate input
20 current_mileage = validate_int(current_mileage, 'current_mileage')
21 last_service_mileage = validate_int(last_service_mileage, 'last_service_mileage')
23 self.current_mileage = current_mileage
24 self.last_service_mileage = last_service_mileage
26 def needs_service(self):
27 """Determines if the WilloughbyEngine should be serviced.
29 Returns:
30 bool: True if the last service mileage exceeds 60000, False otherwise.
31 """
32 return self.current_mileage - self.last_service_mileage > 60000