Coverage for tire/carigan_tire.py: 100%
9 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"""Implements a subclass of the Tire class.
3The module contains the CariganTire class that inherits from the Tire class.
4"""
6from tire.base_tire import Tire
7from utils.input_validator import validate_array
10class CariganTire(Tire):
11 """Creates CariganTire tires.
13 Inherits from the Tire class.
15 methods:
16 needs_serviced: Determines if the tire should be serviced.
17 """
18 tire_wear_sensor = []
20 def __init__(self, tire_wear_sensor: list):
21 """Initializes CariganTire objects."""
22 # validate input
23 tire_wear_sensor = validate_array(tire_wear_sensor, 'tire_wear_sensor')
24 self.tire_wear_sensor = tire_wear_sensor
26 def needs_service(self) -> bool:
27 """Determines if the CariganTire should be serviced.
29 Returns:
30 bool: True if one or more of the values in the
31 tire wear sensor array is greater than or equal to 0.9 and
32 False otherwise.
34 Usage:
35 tire = CariganTire([0.5, 0.8, 0.9])
36 tire.needs_service()
37 """
38 return any(i >= 0.9 for i in self.tire_wear_sensor)