Skip to content

Commit 359918e

Browse files
jjimenezshawsnowman2
authored andcommitted
convert from str to PJType
1 parent 7ca8080 commit 359918e

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
@@ -498,6 +498,9 @@ def query_geodetic_crs_from_datum(
498498
list[CRS]
499499
"""
500500

501+
if pj_type is not None and not isinstance(pj_type, PJType):
502+
pj_type = PJType.create(pj_type)
503+
501504
cdef const char* c_crs_type = NULL
502505
if pj_type is None:
503506
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)