Skip to content

Commit

Permalink
convert from str to PJType
Browse files Browse the repository at this point in the history
  • Loading branch information
jjimenezshaw committed Apr 5, 2024
1 parent 66ceda0 commit e237f2e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pyproj/database.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ def query_geodetic_crs_from_datum(
list[CRS]
"""

if pj_type is not None and not isinstance(pj_type, PJType):
pj_type = PJType.create(pj_type)

cdef const char* c_crs_type = NULL
if pj_type is None:
pass
Expand Down
7 changes: 7 additions & 0 deletions test/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,10 @@ def test_get_database_metadata__invalid():


def test_query_geodetic_crs_from_datum():
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "GEOCENTRIC_CRS")
assert len(crss) == 1
assert crss[0].to_authority()[1] == "6317"

crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.GEOCENTRIC_CRS)
assert len(crss) == 1
assert crss[0].to_authority()[1] == "6317"
Expand Down Expand Up @@ -317,6 +321,9 @@ def test_query_geodetic_crs_from_datum_invalid():
with pytest.raises(ValueError):
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.PROJECTED_CRS)

with pytest.raises(ValueError):
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "invalid string")

with pytest.raises(TypeError):
query_geodetic_crs_from_datum("EPSG", "EPSG", None)

Expand Down

0 comments on commit e237f2e

Please sign in to comment.