Coverage for engine/sternman_engine.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-09 21:08 +0000

1"""This module defines a specilised engine named SternmanEngine. 

2""" 

3from engine.base_engine import Engine 

4from utils.input_validator import validate_bool 

5 

6 

7class SternmanEngine(Engine): 

8 """Creates SternmanEngine objects. 

9 

10 Inherits from the Engine class. 

11 

12 methods: 

13 needs_serviced: Determines if the engine should be serviced. 

14 """ 

15 def __init__(self, warning_light_is_on:bool): 

16 # validate input 

17 warning_light_is_on = validate_bool(warning_light_is_on, 'warning_light_is_on') 

18 self.warning_light_is_on = warning_light_is_on 

19 

20 def needs_service(self) -> bool: 

21 """Determines if the engine should be serviced. 

22 

23 Returns: 

24 bool: True if the warning light is on False otherwise. 

25 """ 

26 if self.warning_light_is_on: 

27 return True 

28 return False