Fix for running GEOS/GDAL tests on Python 2.6 and below.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14474 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f6824840a2
commit
6c85a44416
|
@ -23,6 +23,11 @@ def tuplize(seq):
|
||||||
return seq
|
return seq
|
||||||
|
|
||||||
|
|
||||||
|
def strconvert(d):
|
||||||
|
"Converts all keys in dictionary to str type."
|
||||||
|
return dict([(str(k), v) for k, v in d.iteritems()])
|
||||||
|
|
||||||
|
|
||||||
def get_ds_file(name, ext):
|
def get_ds_file(name, ext):
|
||||||
return os.path.join(TEST_DATA,
|
return os.path.join(TEST_DATA,
|
||||||
name,
|
name,
|
||||||
|
@ -81,7 +86,7 @@ class TestGeomSet(object):
|
||||||
"""
|
"""
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
setattr(self, key, [TestGeom(**kwargs) for kwargs in value])
|
setattr(self, key, [TestGeom(**strconvert(kw)) for kw in value])
|
||||||
|
|
||||||
|
|
||||||
class TestDataMixin(object):
|
class TestDataMixin(object):
|
||||||
|
@ -96,5 +101,5 @@ class TestDataMixin(object):
|
||||||
# Load up the test geometry data from fixture into global.
|
# Load up the test geometry data from fixture into global.
|
||||||
gzf = gzip.GzipFile(os.path.join(TEST_DATA, 'geometries.json.gz'))
|
gzf = gzip.GzipFile(os.path.join(TEST_DATA, 'geometries.json.gz'))
|
||||||
geometries = simplejson.loads(gzf.read())
|
geometries = simplejson.loads(gzf.read())
|
||||||
GEOMETRIES = TestGeomSet(**geometries)
|
GEOMETRIES = TestGeomSet(**strconvert(geometries))
|
||||||
return GEOMETRIES
|
return GEOMETRIES
|
||||||
|
|
Loading…
Reference in New Issue