Example #1
0
def test_string_to_emissions_grid_range():
    assert ef.string_to_emissions_grid_range("MEAN") == ef.GRID_RANGE.MEAN
    assert ef.string_to_emissions_grid_range("MEan") == ef.GRID_RANGE.MEAN
    assert ef.string_to_emissions_grid_range("Median") == ef.GRID_RANGE.MEAN
    assert ef.string_to_emissions_grid_range("high") == ef.GRID_RANGE.HIGH
    assert ef.string_to_emissions_grid_range("LOW") == ef.GRID_RANGE.LOW
    with pytest.raises(ValueError):
        ef.string_to_conversion_source("invalid")
Example #2
0
def test_string_to_emissions_grid_source():
    assert ef.string_to_emissions_grid_source(
        "meta-analysis") == ef.GRID_SOURCE.META
    assert ef.string_to_emissions_grid_source(
        "MeTa_AnAlYsIs") == ef.GRID_SOURCE.META
    assert ef.string_to_emissions_grid_source(
        "META ANALYSIS") == ef.GRID_SOURCE.META
    assert ef.string_to_emissions_grid_source(
        "IPCC_ONLY") == ef.GRID_SOURCE.IPCC
    assert ef.string_to_emissions_grid_source(
        "ipcc only") == ef.GRID_SOURCE.IPCC
    with pytest.raises(ValueError):
        ef.string_to_conversion_source("invalid")
def test_string_to_conversion_source():
    assert ef.string_to_conversion_source("AR5 with feedback") == ef.CO2EQ_SOURCE.AR5_WITH_FEEDBACK
    assert ef.string_to_conversion_source("AR4") == ef.CO2EQ_SOURCE.AR4
    assert ef.string_to_conversion_source("Ar4") == ef.CO2EQ_SOURCE.AR4
    assert ef.string_to_conversion_source("SAR") == ef.CO2EQ_SOURCE.SAR
    assert ef.string_to_conversion_source("sar") == ef.CO2EQ_SOURCE.SAR
    with pytest.raises(ValueError):
        ef.string_to_conversion_source("invalid")