Skip to content

Commit

Permalink
update vector tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atedstone committed Jan 18, 2024
1 parent 99d03a1 commit 414e1d5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/test_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,17 @@ def test_crop(self, data: list[str]) -> None:

# Crop
outlines_new = outlines.copy()
outlines_new.crop(crop_geom=rst)
outlines_new.crop(crop_geom=rst, inplace=True)

# Check default behaviour - crop and return copy
outlines_copy = outlines.crop(crop_geom=rst)

# Crop by passing bounds
outlines_new_bounds = outlines.copy()
outlines_new_bounds.crop(crop_geom=list(rst.bounds))
outlines_new_bounds.crop(crop_geom=list(rst.bounds), inplace=True)
assert_geodataframe_equal(outlines_new.ds, outlines_new_bounds.ds)
# Check the return-by-copy as well
assert_geodataframe_equal(outlines_copy.ds, outlines_new_bounds.ds)

# Check with bracket call
outlines_new2 = outlines_new[rst]
Expand All @@ -235,7 +240,7 @@ def test_crop(self, data: list[str]) -> None:

# Check that error is raised when cropGeom argument is invalid
with pytest.raises(TypeError, match="Crop geometry must be a Raster, Vector, or list of coordinates."):
outlines.crop(1) # type: ignore
outlines.crop(1, inplace=True) # type: ignore

def test_proximity(self) -> None:
"""
Expand Down

0 comments on commit 414e1d5

Please sign in to comment.