def test_check_emission_factor_of_providers_warning(caplog): dict_values = { ENERGY_PROVIDERS: { "Energy provider": { EMISSION_FACTOR: { VALUE: 0.2 }, RENEWABLE_SHARE_DSO: { VALUE: 1 }, }, }, } # logging.warning with caplog.at_level(logging.WARNING): C1.check_emission_factor_of_providers(dict_values) assert ( "Check if this is what you intended to define." in caplog.text ), f"When the emission_factor of the provider is > 0 while the RE share is 1, a warning msg should be logged."
def test_check_emission_factor_of_providers_no_warning_emission_factor_0( caplog): dict_values = { ENERGY_PROVIDERS: { "Energy provider": { EMISSION_FACTOR: { VALUE: 0 }, RENEWABLE_SHARE_DSO: { VALUE: 1 }, }, }, } # logging.warning with caplog.at_level(logging.WARNING): C1.check_emission_factor_of_providers(dict_values) assert ( caplog.text == "" ), f"When the emission_factor of the provider is zero, no warning msg should be logged."
def test_check_emission_factor_of_providers_no_warning_RE_share_lower_1( caplog): dict_values = { ENERGY_PROVIDERS: { "Energy provider": { EMISSION_FACTOR: { VALUE: 0.2 }, RENEWABLE_SHARE_DSO: { VALUE: 0.5 }, }, }, } # logging.warning with caplog.at_level(logging.WARNING): C1.check_emission_factor_of_providers(dict_values) assert ( caplog.text == "" ), f"When the renewable share of the provider is lower than 1, no warning msg should be logged."