@no_oracle # Oracle does not support KML.
    def test03a_kml(self):
        "Testing KML output from the database using GeoManager.kml()."
        if DISABLE: return
        # Should throw a TypeError when trying to obtain KML from a
        #  non-geometry field.
        qs = City.objects.all()
        self.assertRaises(TypeError, qs.kml, 'name')

        # The reference KML depends on the version of PostGIS used 
        # (the output stopped including altitude in 1.3.3).
        major, minor1, minor2 = SpatialBackend.version
        ref_kml1 = '<Point><coordinates>-104.609252,38.255001,0</coordinates></Point>'
        ref_kml2 = '<Point><coordinates>-104.609252,38.255001</coordinates></Point>'
        if major == 1:
            if minor1 > 3 or (minor1 == 3 and minor2 >= 3): ref_kml = ref_kml2
            else: ref_kml = ref_kml1
        else:
            ref_kml = ref_kml2

        # Ensuring the KML is as expected.
        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 dcramer/django-compositepks/django/contrib/gis/tests/geoapp/tests.py/GeoModelTest.test03a_kml/original