

def test_kml(self):
    'Testing KML output from the database using GeoQuerySet.kml().'
    if (not (postgis or (spatialite and connection.ops.kml))):
        self.assertRaises(NotImplementedError, State.objects.all().kml, field_name='poly')
        return
    qs = City.objects.all()
    self.assertRaises(TypeError, qs.kml, 'name')
    if (connection.ops.spatial_version >= (1, 3, 3)):
        ref_kml = '<Point><coordinates>-104.609252,38.255001</coordinates></Point>'
    else:
        ref_kml = '<Point><coordinates>-104.609252,38.255001,0</coordinates></Point>'
    ptown1 = City.objects.kml(field_name='point', precision=9).get(name='Pueblo')
    ptown2 = City.objects.kml(precision=9).get(name='Pueblo')
    for ptown in [ptown1, ptown2]:
        self.assertEqual(ref_kml, ptown.kml)

dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.5/django/contrib/gis/tests/geoapp/tests.py GeoQuerySetTest.test_kml/original