Skip to content

Commit 7b5cb5c

Browse files
committed
convert from str to PJType
1 parent 0b9cb2e commit 7b5cb5c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

pyproj/database.pyx

+3
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,9 @@ def query_geodetic_crs_from_datum(
514514
list[CRS]
515515
"""
516516

517+
if pj_type is not None and not isinstance(pj_type, PJType):
518+
pj_type = PJType.create(pj_type)
519+
517520
cdef const char* c_crs_type = NULL
518521
if pj_type is None:
519522
pass

test/test_database.py

+7
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,10 @@ def test_get_database_metadata__invalid():
272272

273273

274274
def test_query_geodetic_crs_from_datum():
275+
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "GEOCENTRIC_CRS")
276+
assert len(crss) == 1
277+
assert crss[0].to_authority()[1] == "6317"
278+
275279
crss = query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.GEOCENTRIC_CRS)
276280
assert len(crss) == 1
277281
assert crss[0].to_authority()[1] == "6317"
@@ -304,6 +308,9 @@ def test_query_geodetic_crs_from_datum_invalid():
304308
with pytest.raises(ValueError):
305309
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", PJType.PROJECTED_CRS)
306310

311+
with pytest.raises(ValueError):
312+
query_geodetic_crs_from_datum("EPSG", "EPSG", "1116", "invalid string")
313+
307314
with pytest.raises(TypeError):
308315
query_geodetic_crs_from_datum("EPSG", "EPSG", None)
309316

0 commit comments

Comments
 (0)