diff --git a/co2calculator/parameters.py b/co2calculator/parameters.py index 518b8ca..77495d1 100644 --- a/co2calculator/parameters.py +++ b/co2calculator/parameters.py @@ -8,14 +8,12 @@ Size, CarFuel, BusFuel, - TrainFuel, BusTrainRange, FlightRange, FlightClass, FerryClass, ElectricityFuel, HeatingFuel, - Unit, EmissionCategory, ) from typing import Union @@ -25,17 +23,9 @@ class TrainEmissionParameters(BaseModel): category: TransportationMode = EmissionCategory.TRANSPORT subcategory: TransportationMode = TransportationMode.TRAIN - fuel_type: Union[TrainFuel, str] = TrainFuel.AVERAGE range: Union[BusTrainRange, str] = BusTrainRange.LONG_DISTANCE size: Union[Size, str] = Size.AVERAGE - @validator("fuel_type", allow_reuse=True) - def check_fueltype(cls, v): - if isinstance(v, str): - assert v.lower() in (item.value for item in TrainFuel) - v = v.lower() - return TrainFuel(v) - @validator("range", allow_reuse=True) def check_range(cls, v): if isinstance(v, str): diff --git a/tests/functional/test_data_code_compliance.py b/tests/functional/test_data_code_compliance.py index 14b9882..c35fb91 100644 --- a/tests/functional/test_data_code_compliance.py +++ b/tests/functional/test_data_code_compliance.py @@ -9,7 +9,6 @@ emission_factors, ElectricityFuel, Size, - RangeCategory, FlightClass, FerryClass, FlightRange, diff --git a/tests/unit/test_calculate_mobility.py b/tests/unit/test_calculate_mobility.py index d3fb08c..48ee316 100644 --- a/tests/unit/test_calculate_mobility.py +++ b/tests/unit/test_calculate_mobility.py @@ -107,11 +107,10 @@ def test_calc_co2_bus( pytest.param(1162, {}, 38.23, id="defaults on empty"), pytest.param( 1162, - {"fuel_type": "electric", "vehicle_range": "long-distance"}, + {"vehicle_range": "long-distance"}, 37.18, id="all optional arguments", ), - pytest.param(10, {"fuel_type": "diesel"}, 0.7, id="fuel_type: 'electric'"), ], ) def test_calc_co2_train(