'Testing the `distance` GeoQuerySet method used with `transform` on a geographic field.'

@no_oracle
def test03c_distance_method(self):

    if (not connection.ops.geography):
        self.assertRaises(ValueError, CensusZipcode.objects.distance, self.stx_pnt)
    z = SouthTexasZipcode.objects.get(name='77005')
    dists_m = [3553.30384972258, 1243.18391525602, 2186.15439472242]
    buf1 = z.poly.centroid.buffer(100)
    buf2 = buf1.transform(4269, clone=True)
    ref_zips = ['77002', '77025', '77401']
    for buf in [buf1, buf2]:
        qs = CensusZipcode.objects.exclude(name='77005').transform(32140).distance(buf)
        self.assertEqual(ref_zips, self.get_names(qs))
        for (i, z) in enumerate(qs):
            self.assertAlmostEqual(z.distance.m, dists_m[i], 5)
