Skip to content

Commit 52aed96

Browse files
Added test
1 parent b13f24d commit 52aed96

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

threedigrid_builder/tests/test_grid.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,28 @@ def test_split_partial_cut(cell_polygon):
388388
assert fragments[0].equals_exact(cell_polygon, tolerance=0.0)
389389

390390

391+
def test_split_order(cell_polygon):
392+
# This test is to indicate that the order matters
393+
cutlines_2 = [
394+
shapely.LineString([(5, 0), (5, 6)]),
395+
shapely.LineString([(0, 0), (10, 10)]),
396+
]
397+
fragments = Grid.split(cell_polygon, cutlines_2)
398+
assert len(fragments) == 2
399+
400+
cutlines_3 = [
401+
shapely.LineString([(0, 0), (10, 10)]),
402+
shapely.LineString([(5, 0), (5, 5)]),
403+
]
404+
fragments = Grid.split(cell_polygon, cutlines_3)
405+
assert len(fragments) == 3
406+
407+
# Combining the lines in a single linestring solves the problem
408+
cutlines_3 = [shapely.LineString([(0, 0), (10, 10), (5, 5), (5, 0)])]
409+
fragments = Grid.split(cell_polygon, cutlines_3)
410+
assert len(fragments) == 3
411+
412+
391413
def test_split_double_cut(cell_polygon):
392414
cutlines = [
393415
shapely.LineString([(0, 0), (10, 10)]),

0 commit comments

Comments
 (0)