def test_ellipsoid_equals(): ellipsoid = Ellipsoid.from_epsg(7001) assert ellipsoid == 7001 assert not ellipsoid != 7001 assert ellipsoid != "invalid"
def test_ellipsoid__from_string(input_str): ee = Ellipsoid.from_string(input_str) assert ee.name == "Airy 1830"
def test_ellipsoid__from_user_input(user_input): assert Ellipsoid.from_user_input(user_input) == Ellipsoid.from_epsg(7001)
def test_ellipsoid__from_user_input__invalid(): with pytest.raises(CRSError, match="Invalid ellipsoid"): Ellipsoid.from_user_input({})
def test_ellipsoid__from_epsg__invalid(): with pytest.raises(CRSError, match="Invalid authority"): Ellipsoid.from_epsg(1)
def test_ellipsoid__from_authority__invalid(): with pytest.raises(CRSError, match="Invalid authority"): Ellipsoid.from_authority("BOB", 1)
def test_ellipsoid__from_epsg(): assert Ellipsoid.from_epsg(7030).to_wkt() == ( 'ELLIPSOID["WGS 84",6378137,298.257223563,' 'LENGTHUNIT["metre",1],ID["EPSG",7030]]')
def test_ellipsoid__from_epsg__empty(): assert Ellipsoid.from_epsg(1) is None
def test_ellipsoid__from_name__invalid__auth(): with pytest.raises(CRSError, match="Invalid ellipsoid name"): Ellipsoid.from_name("intl", auth_name="ESRI")
def test_ellipsoid__from_string__invalid(invalid_str): with pytest.raises(CRSError, match="Invalid ellipsoid string"): Ellipsoid.from_string(invalid_str)
with pytest.raises(CRSError, match="Invalid authority"): Ellipsoid.from_epsg(1) def test_ellipsoid__from_authority__invalid(): with pytest.raises(CRSError, match="Invalid authority"): Ellipsoid.from_authority("BOB", 1) @pytest.mark.parametrize( "user_input", [ 7001, ("EPSG", 7001), "urn:ogc:def:ellipsoid:EPSG::7001", Ellipsoid.from_epsg(7001), Ellipsoid.from_epsg(7001).to_json_dict(), "Airy 1830", ], ) def test_ellipsoid__from_user_input(user_input): assert Ellipsoid.from_user_input(user_input) == Ellipsoid.from_epsg(7001) def test_ellipsoid__from_user_input__invalid(): with pytest.raises(CRSError, match="Invalid ellipsoid"): Ellipsoid.from_user_input({}) CS_JSON_DICT = { "$schema":
def test_ellipsoid__from_string__invalid(): with pytest.raises(CRSError, match="Invalid ellipsoid string"): Ellipsoid.from_string("3-598y5-98y") with pytest.raises(CRSError, match="Invalid ellipsoid string"): Ellipsoid.from_string("urn:ogc:def:datum:EPSG::6326")
def test_ellipsoid__from_string(): ee = Ellipsoid.from_string("urn:ogc:def:ellipsoid:EPSG::7001") assert ee.name == "Airy 1830"
def test_ellipsoid__from_name(input_str, long_name): ee = Ellipsoid.from_name(input_str) assert ee.name == long_name
def test_ellipsoid__from_authority(): assert Ellipsoid.from_authority("EPSG", 7030).name == "WGS 84"
def test_ellipsoid__from_name__invalid(invalid_str): with pytest.raises(CRSError, match="Invalid ellipsoid name"): Ellipsoid.from_name(invalid_str)
def test_ellipsoid__from_epsg(): assert Ellipsoid.from_epsg(7030).to_wkt() == ( 'ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]' )