-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_emptiness.py
53 lines (37 loc) · 1.42 KB
/
test_emptiness.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from . import unittest
from shapely.geometry.base import BaseGeometry
import shapely.geometry as sgeom
from shapely.geometry.polygon import LinearRing
class EmptinessTestCase(unittest.TestCase):
def test_empty_base(self):
g = BaseGeometry()
self.assertTrue(g._is_empty)
def test_emptying_point(self):
p = sgeom.Point(0, 0)
self.assertFalse(p._is_empty)
p.empty()
self.assertTrue(p._is_empty)
def test_none_geom(self):
p = BaseGeometry()
p._geom = None
self.assertTrue(p.is_empty)
def test_empty_point(self):
self.assertTrue(sgeom.Point().is_empty)
def test_empty_multipoint(self):
self.assertTrue(sgeom.MultiPoint().is_empty)
def test_empty_geometry_collection(self):
self.assertTrue(sgeom.GeometryCollection().is_empty)
def test_empty_linestring(self):
self.assertTrue(sgeom.LineString().is_empty)
def test_empty_multilinestring(self):
self.assertTrue(sgeom.MultiLineString([]).is_empty)
def test_empty_polygon(self):
self.assertTrue(sgeom.Polygon().is_empty)
def test_empty_multipolygon(self):
self.assertTrue(sgeom.MultiPolygon([]).is_empty)
def test_empty_linear_ring(self):
self.assertTrue(LinearRing().is_empty)
def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(EmptinessTestCase)
if __name__ == '__main__':
unittest.main()