コード例 #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
ファイル: test_crs.py プロジェクト: LucaDeSiena/pyproj
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
ファイル: test_crs.py プロジェクト: wenzeslaus/pyproj
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
ファイル: test_crs.py プロジェクト: wenzeslaus/pyproj
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
ファイル: test_crs.py プロジェクト: micahcochran/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]]'
    )