Skip to content

Commit

Permalink
Test un-common paths in xr-interop
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill888 committed Jan 18, 2022
1 parent ca77919 commit 202cd8a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_xr_interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,30 @@ def test_corrupt_inputs(xx_epsg4326: xr.DataArray):
with pytest.warns(UserWarning):
xx.odc.crs == "epsg:4326"

# attribute based search with bad CRS string
xx = purge_crs_info(xx_epsg4326)
assert xx.odc.crs is None
xx = xx.assign_attrs(crs="!some invalid CRS string!!")
with pytest.warns(UserWarning):
assert xx.odc.crs is None

# attribute based search with bad CRS type
xx = purge_crs_info(xx_epsg4326)
assert xx.odc.crs is None
xx = xx.assign_attrs(crs=[])
with pytest.warns(UserWarning):
assert xx.odc.crs is None

# attribute based search with several different CRS candidates
xx = purge_crs_info(xx_epsg4326)
assert xx.odc.crs is None
xx = xx.assign_attrs(crs="epsg:4326")
xx.latitude.attrs["crs"] = epsg3577
with pytest.warns(UserWarning):
_crs = xx.odc.crs
assert _crs is not None
assert _crs == epsg3577 or _crs == "epsg:4326"


def test_geobox_hook(xx_epsg4326: xr.DataArray):
register_geobox()
Expand Down

0 comments on commit 202cd8a

Please sign in to comment.