web/lib/django/contrib/gis/tests/geoapp/test_regress.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
equal deleted inserted replaced
28:b758351d191f 29:cc9b7e14412b
     1 import os, unittest
     1 import os, unittest
     2 from django.contrib.gis.db.backend import SpatialBackend
       
     3 from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_postgis, no_spatialite
     2 from django.contrib.gis.tests.utils import no_mysql, no_oracle, no_postgis, no_spatialite
     4 from django.contrib.gis.shortcuts import render_to_kmz
     3 from django.contrib.gis.shortcuts import render_to_kmz
     5 from models import City
     4 from models import City
     6 
     5 
     7 class GeoRegressionTests(unittest.TestCase):
     6 class GeoRegressionTests(unittest.TestCase):
    26                   'kml' : '<Point><coordinates>5.0,23.0</coordinates></Point>'
    25                   'kml' : '<Point><coordinates>5.0,23.0</coordinates></Point>'
    27                   }]
    26                   }]
    28         kmz = render_to_kmz('gis/kml/placemarks.kml', {'places' : places})
    27         kmz = render_to_kmz('gis/kml/placemarks.kml', {'places' : places})
    29 
    28 
    30     @no_spatialite
    29     @no_spatialite
       
    30     @no_mysql
    31     def test03_extent(self):
    31     def test03_extent(self):
    32         "Testing `extent` on a table with a single point, see #11827."
    32         "Testing `extent` on a table with a single point, see #11827."
    33         pnt = City.objects.get(name='Pueblo').point
    33         pnt = City.objects.get(name='Pueblo').point
    34         ref_ext = (pnt.x, pnt.y, pnt.x, pnt.y)
    34         ref_ext = (pnt.x, pnt.y, pnt.x, pnt.y)
    35         self.assertEqual(ref_ext, City.objects.filter(name='Pueblo').extent())
    35         extent = City.objects.filter(name='Pueblo').extent()
       
    36         for ref_val, val in zip(ref_ext, extent):
       
    37             self.assertAlmostEqual(ref_val, val, 4)