This commit is contained in:
2025-01-26 19:24:23 -08:00
parent 32cd60e92b
commit d1dde0dbc6
4155 changed files with 29170 additions and 216373 deletions

View File

@@ -3,6 +3,7 @@ import unittest
import pytest
import shapely
from shapely import geos_version
from shapely.errors import TopologicalError
from shapely.geometry import GeometryCollection, LineString, MultiPoint, Point, Polygon
from shapely.wkt import loads
@@ -79,8 +80,11 @@ class OperationsTestCase(unittest.TestCase):
"POLYGON ((40 100, 80 100, 80 60, 40 60, 40 100), (60 60, 80 60, 80 40, 60 40, 60 60))"
)
assert not invalid_polygon.is_valid
with pytest.raises((TopologicalError, shapely.GEOSException)):
invalid_polygon.relate(invalid_polygon)
if geos_version < (3, 13, 0):
with pytest.raises((TopologicalError, shapely.GEOSException)):
invalid_polygon.relate(invalid_polygon)
else: # resolved with RelateNG
assert invalid_polygon.relate(invalid_polygon) == "2FFF1FFF2"
def test_hausdorff_distance(self):
point = Point(1, 1)

View File

@@ -5,6 +5,7 @@ import unittest
import pytest
import shapely
from shapely import geos_version
from shapely.geometry import Point, Polygon
@@ -67,8 +68,15 @@ class PredicatesTestCase(unittest.TestCase):
(339, 207),
]
with pytest.raises(shapely.GEOSException):
Polygon(p1).within(Polygon(p2))
g1 = Polygon(p1)
g2 = Polygon(p2)
assert not g1.is_valid
assert not g2.is_valid
if geos_version < (3, 13, 0):
with pytest.raises(shapely.GEOSException):
g1.within(g2)
else: # resolved with RelateNG
assert not g1.within(g2)
def test_relate_pattern(self):