def test_units_map__deprecated(deprecated): units_map = get_units_map(allow_deprecated=deprecated) assert len(units_map) > 1 any_deprecated = False for item in units_map.values(): any_deprecated = any_deprecated or item.deprecated assert any_deprecated
def test_units_map__default(): units_map = get_units_map() assert isinstance(units_map["metre"], Unit) assert units_map["metre"].name == "metre" assert units_map["metre"].auth_name == "EPSG" assert units_map["metre"].code == "9001" assert units_map["metre"].category == "linear" assert units_map["metre"].conv_factor == 1 assert units_map["metre"].proj_short_name == "m" assert not units_map["metre"].deprecated any_deprecated = False for item in units_map.values(): any_deprecated = any_deprecated or item.deprecated assert not any_deprecated
def test_units_map(): units_map = get_units_map() assert isinstance(units_map["m"], Unit) assert units_map["m"].id == "m" assert units_map["m"].name == "Meter"
def test_units_map__invalid(auth_name, category): with pytest.raises(TypeError): get_units_map(auth_name=auth_name, category=category)
def test_units_map__auth_name(auth_name): units_map = get_units_map(auth_name=auth_name) assert len(units_map) > 1 for item in units_map.values(): assert item.auth_name == auth_name
def test_units_map__category(category): units_map = get_units_map(category=category) assert len(units_map) > 1 for item in units_map.values(): assert item.category == category
def test_units_map(): with pytest.warns(DeprecationWarning): units_map = get_units_map() assert isinstance(units_map["m"], Unit) assert units_map["m"].id == "m" assert units_map["m"].name == "Meter"