/usr/share/pyshared/shapely/tests/test_equality.py is in python-shapely 1.2.14-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | import unittest
from shapely import geometry
class PointEqualityTestCase(unittest.TestCase):
def test_equals_exact(self):
p1 = geometry.Point(1.0, 1.0)
p2 = geometry.Point(2.0, 2.0)
self.failIf(p1.equals(p2))
self.failIf(p1.equals_exact(p2, 0.001))
def test_almost_equals_default(self):
p1 = geometry.Point(1.0, 1.0)
p2 = geometry.Point(1.0+1e-7, 1.0+1e-7) # almost equal to 6 places
p3 = geometry.Point(1.0+1e-6, 1.0+1e-6) # not almost equal
self.failUnless(p1.almost_equals(p2))
self.failIf(p1.almost_equals(p3))
def test_almost_equals(self):
p1 = geometry.Point(1.0, 1.0)
p2 = geometry.Point(1.1, 1.1)
self.failIf(p1.equals(p2))
self.failUnless(p1.almost_equals(p2, 0))
self.failIf(p1.almost_equals(p2, 1))
def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(
PointEqualityTestCase
)
|