'Testing pickling and unpickling support.'

def test_pickle(self):

    from django.utils.six.moves import cPickle
    import pickle
    def get_geoms(lst, srid=None):
        return [GEOSGeometry(tg.wkt, srid) for tg in lst]
    tgeoms = get_geoms(self.geometries.points)
    tgeoms.extend(get_geoms(self.geometries.multilinestrings, 4326))
    tgeoms.extend(get_geoms(self.geometries.polygons, 3084))
    tgeoms.extend(get_geoms(self.geometries.multipolygons, 900913))
    no_srid = (self.null_srid == (-1))
    for geom in tgeoms:
        (s1, s2) = (cPickle.dumps(geom), pickle.dumps(geom))
        (g1, g2) = (cPickle.loads(s1), pickle.loads(s2))
        for tmpg in (g1, g2):
            self.assertEqual(geom, tmpg)
            if (not no_srid):
                self.assertEqual(geom.srid, tmpg.srid)
