Skip to content

Commit

Permalink
Fix tests #337
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderJuestel committed Jul 20, 2024
1 parent cbc9f31 commit 218341b
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions tests/test_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4910,17 +4910,17 @@ def test_extract_orientations_from_cross_sections():
assert {'X', 'Y', 'Z', 'dip', 'azimuth', 'polarity', 'geometry'}.issubset(orientation.columns)


# Testing intersection_polygon_polygon
# Testing intersect_polygon_polygon
##########################################################
def test_intersection_polygon_polygon():
from gemgis.vector import intersection_polygon_polygon
def test_intersect_polygon_polygon():
from gemgis.vector import intersect_polygon_polygon

polygon1 = Polygon([(0, 0), (10, 0), (10, 10), (0, 10)])

polygon2 = Polygon([(10, 0), (20, 0), (20, 10), (10, 10)])

intersection = intersection_polygon_polygon(polygon1=polygon1,
polygon2=polygon2)
intersection = intersect_polygon_polygon(polygon1=polygon1,
polygon2=polygon2)

assert isinstance(intersection, LineString)
assert intersection.wkt == 'LINESTRING (10 0, 10 10)'
Expand All @@ -4929,29 +4929,28 @@ def test_intersection_polygon_polygon():

polygon2 = Polygon([(5, 0), (15, 0), (15, 10), (5, 10)])

intersection = intersection_polygon_polygon(polygon1=polygon1,
polygon2=polygon2)
intersection = intersect_polygon_polygon(polygon1=polygon1,
polygon2=polygon2)

assert isinstance(intersection, Polygon)
try:
assert intersection.wkt == 'POLYGON ((10 0, 5 0, 5 10, 10 10, 10 0))'
except AssertionError:
assert intersection.wkt == 'POLYGON ((5 0, 5 10, 10 10, 10 0, 5 0))'

# Testing intersection_polygon_polygons


# Testing intersect_polygon_polygons
##########################################################
def test_intersections_polygon_polygons():
from gemgis.vector import intersections_polygon_polygons
def test_intersect_polygon_polygons():
from gemgis.vector import intersect_polygon_polygons

polygon1 = Polygon([(0, 0), (10, 0), (10, 10), (0, 10)])

polygons2 = [Polygon([(10, 0), (20, 0), (20, 10), (10, 10)]),
Polygon([(5, 0), (15, 0), (15, 10), (5, 10)])]

intersections = intersections_polygon_polygons(polygon1=polygon1,
polygons2=polygons2)
intersections = intersect_polygon_polygons(polygon1=polygon1,
polygons2=polygons2)

assert isinstance(intersections, list)
assert len(intersections) == 2
Expand All @@ -4965,17 +4964,17 @@ def test_intersections_polygon_polygons():
assert intersections[1].wkt == 'POLYGON ((5 0, 5 10, 10 10, 10 0, 5 0))'


# Testing intersection_polygon_polygons
# Testing intersect_polygon_polygons
##########################################################
def test_intersections_polygons_polygons():
from gemgis.vector import intersections_polygons_polygons
def test_intersect_polygons_polygons():
from gemgis.vector import intersect_polygons_polygons

polygons = [Polygon([(0, 0), (10, 0), (10, 10), (0, 10)]),
Polygon([(10, 0), (20, 0), (20, 10), (10, 10)]),
Polygon([(5, 0), (15, 0), (15, 10), (5, 10)])]

intersections = intersections_polygons_polygons(polygons1=polygons,
polygons2=polygons)
intersections = intersect_polygons_polygons(polygons1=polygons,
polygons2=polygons)

assert isinstance(intersections, list)
assert len(intersections) == 9
Expand Down

0 comments on commit 218341b

Please sign in to comment.