@@ -238,6 +238,45 @@ def test_compute_output_grid_with_lite_crs(self):
238238 assert top > bottom
239239
240240
241+ # -----------------------------------------------------------------------
242+ # Integration: CRS resolution works when pyproj is blocked
243+ # -----------------------------------------------------------------------
244+ class TestNoPyproj :
245+ """Verify CRS resolution works for supported codes when pyproj is absent."""
246+
247+ def test_resolve_without_pyproj (self , monkeypatch ):
248+ """_resolve_crs and _crs_from_wkt work without pyproj for known EPSG codes."""
249+ import sys
250+ from xrspatial .reproject ._lite_crs import CRS
251+
252+ # Block pyproj import
253+ monkeypatch .setitem (sys .modules , 'pyproj' , None )
254+
255+ from xrspatial .reproject ._crs_utils import _resolve_crs , _crs_from_wkt
256+
257+ src_crs = _resolve_crs (4326 )
258+ assert isinstance (src_crs , CRS )
259+ assert src_crs .to_epsg () == 4326
260+
261+ tgt_crs = _resolve_crs ("EPSG:32632" )
262+ assert isinstance (tgt_crs , CRS )
263+ assert tgt_crs .is_geographic is False
264+
265+ # _crs_from_wkt round-trips without pyproj
266+ wkt = src_crs .to_wkt ()
267+ restored = _crs_from_wkt (wkt )
268+ assert isinstance (restored , CRS )
269+ assert restored .to_epsg () == 4326
270+
271+ def test_unknown_epsg_without_pyproj_raises (self , monkeypatch ):
272+ """Unknown EPSG codes raise clear error when pyproj is absent."""
273+ import sys
274+ monkeypatch .setitem (sys .modules , 'pyproj' , None )
275+ from xrspatial .reproject ._crs_utils import _resolve_crs
276+ with pytest .raises ((ImportError , ValueError )):
277+ _resolve_crs (2193 )
278+
279+
241280# -----------------------------------------------------------------------
242281# Validate against pyproj (skipped when pyproj not installed)
243282# -----------------------------------------------------------------------
0 commit comments