Skip to content

Commit

Permalink
fix(test_carbon_footprint.py): implement missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnVonNeumann committed Dec 15, 2024
1 parent dfc5678 commit ecadee6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/carbon_footprint/test_carbon_footprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,28 @@ def test_carbon_footprint_invalid_product_or_sector_specific_rules(
CarbonFootprint(**invalid_data)
assert str(excinfo.value) == expected_error


def test_carbon_footprint_secondary_emission_factor_sources(valid_carbon_footprint_data):
carbon_footprint = CarbonFootprint(**valid_carbon_footprint_data)
assert isinstance(carbon_footprint.secondary_emission_factor_sources, EmissionFactorDSSet)


@pytest.mark.parametrize(
"secondary_emission_factor_sources, expected_error",
[
(1, "secondary_emission_factor_sources must be an instance of EmissionFactorDSSet"),
],
)
def test_carbon_footprint_invalid_secondary_emission_factor_sources(
valid_carbon_footprint_data, secondary_emission_factor_sources, expected_error
):
invalid_data = valid_carbon_footprint_data.copy()
invalid_data["secondary_emission_factor_sources"] = secondary_emission_factor_sources
with pytest.raises(ValueError) as excinfo:
CarbonFootprint(**invalid_data)
assert str(excinfo.value) == expected_error


def test_carbon_footprint_str(valid_carbon_footprint_data):
carbon_footprint = CarbonFootprint(**valid_carbon_footprint_data)
assert str(carbon_footprint) == (
Expand Down

0 comments on commit ecadee6

Please sign in to comment.