/usr/share/pyshared/shapely/tests/test_delegated.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 | import unittest
from shapely.geometry import Point
from shapely.impl import BaseImpl
from shapely.geometry.base import delegated
class Geometry(object):
impl = BaseImpl({})
@property
@delegated
def foo(self):
return self.impl['foo']()
class WrapperTestCase(unittest.TestCase):
"""When the backend has no support for a method, we get an AttributeError"""
def test_delegated(self):
self.assertRaises(AttributeError, getattr, Geometry(), 'foo')
def test_defaultimpl(self):
project_impl = Point.impl.map.pop('project', None)
try:
self.assertRaises(AttributeError, Point(0, 0).project, 1.0)
finally:
if project_impl is not None:
Point.impl.map['project'] = project_impl
def test_suite():
return unittest.TestLoader().loadTestsFromTestCase(WrapperTestCase)
|