def test_car_age(days, expected): assert Car.age(days) == expected
def test_the_same_configuration(list1, list2, expected): assert Car.has_same_configuration(list1, list2) == expected
class NewList(list): pass # A bunch of lists to test l1 = [["gas", "electro", "hybrid"], "200 PS", "radio"] l2 = l1 l3 = l1.copy() l4 = l1[0] l5 = [l4, "digital radio"] l6 = [l1[0], "digital radio"] l7 = NewList(l1) l8 = ["unleaded"] # A bunch of `Car`s my_car = Car("Toyota Corolla", "black") other_car1 = my_car other_car2 = Car("Toyota Corolla", "black") other_car3 = Car("Toyota Corolla", "red") other_car4 = Car("Porsche Cayenne", "black") # Test staticmethod Car.age @pytest.mark.parametrize( "days, expected", [ (7, "A week old"), # week (365, "A year old"), # year (2, "Neither a week, nor a year old"), # Other number ], )