'Testing KML output from the database using GeoQuerySet.kml().'

def test03a_kml(self):

    if (not postgis):
        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)
