summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Fedoseev <fedoseev.sergey@gmail.com>2015-11-20 15:11:25 +0500
committerTim Graham <timograham@gmail.com>2015-11-20 12:36:03 -0500
commitccc8f67b7760dd12faf6007f12a672a8e03f4d88 (patch)
treefb9239ba533a82717f7f3b808614aad9ebb42c2d /tests
parent73a6ab6382809d5452907dcff5767403d8d66985 (diff)
Fixed #25722 -- Added the GEOSGeometry.covers() method.
Diffstat (limited to 'tests')
-rw-r--r--tests/gis_tests/geos_tests/test_geos.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/gis_tests/geos_tests/test_geos.py b/tests/gis_tests/geos_tests/test_geos.py
index b68720c89e..301d406317 100644
--- a/tests/gis_tests/geos_tests/test_geos.py
+++ b/tests/gis_tests/geos_tests/test_geos.py
@@ -643,6 +643,11 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
self.assertAlmostEqual(exp_ring[k][0], buf_ring[k][0], 9)
self.assertAlmostEqual(exp_ring[k][1], buf_ring[k][1], 9)
+ def test_covers(self):
+ poly = Polygon(((0, 0), (0, 10), (10, 10), (10, 0), (0, 0)))
+ self.assertTrue(poly.covers(Point(5, 5)))
+ self.assertFalse(poly.covers(Point(100, 100)))
+
def test_srid(self):
"Testing the SRID property and keyword."
# Testing SRID keyword on Point
@@ -1084,12 +1089,11 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
# A set of test points.
pnts = [Point(5, 5), Point(7.5, 7.5), Point(2.5, 7.5)]
- covers = [True, True, False] # No `covers` op for regular GEOS geoms.
- for pnt, c in zip(pnts, covers):
+ for pnt in pnts:
# Results should be the same (but faster)
self.assertEqual(mpoly.contains(pnt), prep.contains(pnt))
self.assertEqual(mpoly.intersects(pnt), prep.intersects(pnt))
- self.assertEqual(c, prep.covers(pnt))
+ self.assertEqual(mpoly.covers(pnt), prep.covers(pnt))
self.assertTrue(prep.crosses(fromstr('LINESTRING(1 1, 15 15)')))
self.assertTrue(prep.disjoint(Point(-5, -5)))