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 19, 2024
1 parent 0b9cb2e commit 7b5cb5c
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 @@ -514,6 +514,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 @@ -272,6 +272,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 @@ -304,6 +308,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 7b5cb5c

Please sign in to comment.