~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/contrib/gis/geos/tests/test_geos_mutation.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone
  • Date: 2013-11-07 15:33:49 UTC
  • mfrom: (1.3.12)
  • Revision ID: package-import@ubuntu.com-20131107153349-e31sc149l2szs3jb
Tags: 1.6-1
* New upstream version. Closes: #557474, #724637.
* python-django now also suggests the installation of ipython,
  bpython, python-django-doc, and libgdal1.
  Closes: #636511, #686333, #704203
* Set package maintainer to Debian Python Modules Team.
* Bump standards version to 3.9.5, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
# Modified from original contribution by Aryeh Leib Taurog, which was
3
3
# released under the New BSD license.
4
4
 
5
 
from django.contrib.gis.geos import *
6
 
from django.contrib.gis.geos.error import GEOSIndexError
7
5
from django.utils import unittest
 
6
from django.utils.unittest import skipUnless
 
7
 
 
8
from .. import HAS_GEOS
 
9
 
 
10
if HAS_GEOS:
 
11
    from .. import *
 
12
    from ..error import GEOSIndexError
 
13
 
8
14
 
9
15
def getItem(o,i): return o[i]
10
16
def delItem(o,i): del o[i]
11
17
def setItem(o,i,v): o[i] = v
12
18
 
13
 
def api_get_distance(x): return x.distance(Point(-200,-200))
 
19
if HAS_GEOS:
 
20
    def api_get_distance(x): return x.distance(Point(-200,-200))
 
21
 
14
22
def api_get_buffer(x): return x.buffer(10)
15
23
def api_get_geom_typeid(x): return x.geom_typeid
16
24
def api_get_num_coords(x): return x.num_coords
29
37
                        if hasattr(val, '__call__')
30
38
                        and name.startswith('api_get_') ]
31
39
 
 
40
 
 
41
@skipUnless(HAS_GEOS, "Geos is required.")
32
42
class GEOSMutationTest(unittest.TestCase):
33
43
    """
34
44
    Tests Pythonic Mutability of Python GEOS geometry wrappers
122
132
            lsa = MultiPoint(*map(Point,((5,5),(3,-2),(8,1))))
123
133
            for f in geos_function_tests:
124
134
                self.assertEqual(f(lsa), f(mp), 'MultiPoint ' + f.__name__)
125
 
 
126
 
def suite():
127
 
    s = unittest.TestSuite()
128
 
    s.addTest(unittest.makeSuite(GEOSMutationTest))
129
 
    return s
130
 
 
131
 
def run(verbosity=2):
132
 
    unittest.TextTestRunner(verbosity=verbosity).run(suite())
133
 
 
134
 
if __name__ == '__main__':
135
 
    run()