예제 #1
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid_equals():
    ellipsoid = Ellipsoid.from_epsg(7001)
    assert ellipsoid == 7001
    assert not ellipsoid != 7001
    assert ellipsoid != "invalid"
예제 #2
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_string(input_str):
    ee = Ellipsoid.from_string(input_str)
    assert ee.name == "Airy 1830"
예제 #3
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_user_input(user_input):
    assert Ellipsoid.from_user_input(user_input) == Ellipsoid.from_epsg(7001)
예제 #4
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_user_input__invalid():
    with pytest.raises(CRSError, match="Invalid ellipsoid"):
        Ellipsoid.from_user_input({})
예제 #5
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_epsg__invalid():
    with pytest.raises(CRSError, match="Invalid authority"):
        Ellipsoid.from_epsg(1)
예제 #6
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_authority__invalid():
    with pytest.raises(CRSError, match="Invalid authority"):
        Ellipsoid.from_authority("BOB", 1)
예제 #7
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_epsg():
    assert Ellipsoid.from_epsg(7030).to_wkt() == (
        'ELLIPSOID["WGS 84",6378137,298.257223563,'
        'LENGTHUNIT["metre",1],ID["EPSG",7030]]')
예제 #8
0
def test_ellipsoid__from_epsg__empty():
    assert Ellipsoid.from_epsg(1) is None
예제 #9
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_name__invalid__auth():
    with pytest.raises(CRSError, match="Invalid ellipsoid name"):
        Ellipsoid.from_name("intl", auth_name="ESRI")
예제 #10
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_string__invalid(invalid_str):
    with pytest.raises(CRSError, match="Invalid ellipsoid string"):
        Ellipsoid.from_string(invalid_str)
예제 #11
0
파일: test_crs.py 프로젝트: djhoese/pyproj
    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":
예제 #12
0
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")
예제 #13
0
def test_ellipsoid__from_string():
    ee = Ellipsoid.from_string("urn:ogc:def:ellipsoid:EPSG::7001")
    assert ee.name == "Airy 1830"
예제 #14
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_name(input_str, long_name):
    ee = Ellipsoid.from_name(input_str)
    assert ee.name == long_name
예제 #15
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_authority():
    assert Ellipsoid.from_authority("EPSG", 7030).name == "WGS 84"
예제 #16
0
파일: test_crs.py 프로젝트: djhoese/pyproj
def test_ellipsoid__from_name__invalid(invalid_str):
    with pytest.raises(CRSError, match="Invalid ellipsoid name"):
        Ellipsoid.from_name(invalid_str)
예제 #17
0
def test_ellipsoid__from_epsg():
    assert Ellipsoid.from_epsg(7030).to_wkt() == (
        'ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1],ID["EPSG",7030]]'
    )