Made minimal changes to make gis test suite start with Python 3

This commit is contained in:
Claude Paroz 2012-09-12 14:50:16 +02:00
parent 1aa218b857
commit c2c8d4044e
3 changed files with 9 additions and 5 deletions

View File

@ -110,7 +110,7 @@ def geos_version_info():
is a release candidate (and what number release candidate), and the C API is a release candidate (and what number release candidate), and the C API
version. version.
""" """
ver = geos_version() ver = geos_version().decode()
m = version_regex.match(ver) m = version_regex.match(ver)
if not m: raise GEOSException('Could not parse version info string "%s"' % ver) if not m: raise GEOSException('Could not parse version info string "%s"' % ver)
return dict((key, m.group(key)) for key in ('version', 'release_candidate', 'capi_version', 'major', 'minor', 'subminor')) return dict((key, m.group(key)) for key in ('version', 'release_candidate', 'capi_version', 'major', 'minor', 'subminor'))

View File

@ -215,15 +215,18 @@ class ListMixin(object):
"Standard list reverse method" "Standard list reverse method"
self[:] = self[-1::-1] self[:] = self[-1::-1]
def sort(self, cmp=cmp, key=None, reverse=False): def sort(self, cmp=None, key=None, reverse=False):
"Standard list sort method" "Standard list sort method"
if key: if key:
temp = [(key(v),v) for v in self] temp = [(key(v),v) for v in self]
temp.sort(cmp=cmp, key=lambda x: x[0], reverse=reverse) temp.sort(key=lambda x: x[0], reverse=reverse)
self[:] = [v[1] for v in temp] self[:] = [v[1] for v in temp]
else: else:
temp = list(self) temp = list(self)
temp.sort(cmp=cmp, reverse=reverse) if cmp is not None:
temp.sort(cmp=cmp, reverse=reverse)
else:
temp.sort(reverse=reverse)
self[:] = temp self[:] = temp
### Private routines ### ### Private routines ###

View File

@ -16,7 +16,8 @@ test_suites = [
def suite(): def suite():
"Builds a test suite for the GEOS tests." "Builds a test suite for the GEOS tests."
s = TestSuite() s = TestSuite()
map(s.addTest, test_suites) for suite in test_suites:
s.addTest(suite)
return s return s
def run(verbosity=1): def run(verbosity=1):