summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 96030cf)
raw | patch | inline | side by side (parent: 96030cf)
author | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 9 Oct 2009 14:32:21 +0000 (14:32 +0000) | ||
committer | schlatterbeck <schlatterbeck@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Fri, 9 Oct 2009 14:32:21 +0000 (14:32 +0000) |
- rename testdata in test/test_anypy_hashlib.py, python2.3 testsuite
will try to execute anything that starts with "test".
- fix generator expressions in roundup/admin.py
- fix sort calls with key attribute, use a standard (slower) compare
function instead
- Add 'sqlite' to ImportError exceptions when searching for backends
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4373 57a73879-2fb5-44c3-a270-3262357dd7e2
will try to execute anything that starts with "test".
- fix generator expressions in roundup/admin.py
- fix sort calls with key attribute, use a standard (slower) compare
function instead
- Add 'sqlite' to ImportError exceptions when searching for backends
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4373 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/admin.py | patch | blob | history | |
roundup/backends/__init__.py | patch | blob | history | |
roundup/cgi/form_parser.py | patch | blob | history | |
test/test_anypy_hashlib.py | patch | blob | history |
diff --git a/roundup/admin.py b/roundup/admin.py
index 83728c75949c7248a1c9c8e0fcf96347b858ae30..077a2f5f653b3cc5fe2131bbf89bc776895145ee 100644 (file)
--- a/roundup/admin.py
+++ b/roundup/admin.py
sys.stdout.flush()
node = cl.getnode(nodeid)
exp = cl.export_list(propnames, nodeid)
- lensum = sum (len (repr(node[p])) for p in propnames)
+ lensum = sum ([len (repr(node[p])) for p in propnames])
# for a safe upper bound of field length we add
# difference between CSV len and sum of all field lengths
- d = sum (len(x) for x in exp) - lensum
+ d = sum ([len(x) for x in exp]) - lensum
assert (d > 0)
for p in propnames:
ll = len(repr(node[p])) + d
index a89223ae1be9689e9e3f3b5d6d5810e20bd3264b..87351518219103fa937c9eb15a35c5188b1c4c4b 100644 (file)
'mysql': ('MySQLdb',),
'postgresql': ('psycopg',),
'tsearch2': ('psycopg',),
- 'sqlite': ('pysqlite', 'pysqlite2', 'sqlite3', '_sqlite3'),
+ 'sqlite': ('pysqlite', 'pysqlite2', 'sqlite3', '_sqlite3', 'sqlite'),
}
def get_backend(name):
index cf6bb2548e1ba0338d06ec1f2890c04930a9af80..ce6b630be059c8682650aefa8f48e8f6cc1dbb12 100755 (executable)
value = existing
# Sort the value in the same order used by
# Multilink.from_raw.
- value.sort(key = lambda x: int(x))
+ value.sort(lambda x, y: cmp(int(x),int(y)))
elif value == '':
# other types should be None'd if there's no value
# The canonical order (given in Multilink.from_raw) is
# by the numeric value of the IDs.
if isinstance(proptype, hyperdb.Multilink):
- existing.sort(key = lambda x: int(x))
+ existing.sort(lambda x, y: cmp(int(x),int(y)))
# "missing" existing values may not be None
if not existing:
index cdfb4f1e24bdcb9dcf29e0a208b5e7ee58334f36..c3c7ec4a98aa546f95754b8b9515f6e888ab4dcc 100644 (file)
class TestCase_anypy_hashlib(unittest.TestCase):
"""test the hashlib compatibility layer"""
- testdata = (
+ data_for_test = (
('',
'da39a3ee5e6b4b0d3255bfef95601890afd80709',
'd41d8cd98f00b204e9800998ecf8427e'),
# the following two are always excecuted:
def test_sha1_expected_anypy(self):
"""...anypy.hashlib_.sha1().hexdigest() yields expected results"""
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(roundup.anypy.hashlib_.sha1(src).hexdigest(), SHA)
def test_md5_expected_anypy(self):
"""...anypy.hashlib_.md5().hexdigest() yields expected results"""
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(roundup.anypy.hashlib_.md5(src).hexdigest(), MD5)
# execution depending on availability of modules:
if md5.md5 is hashlib.md5:
return
else:
- for s, i1, i2 in self.testdata:
+ for s, i1, i2 in self.data_for_test:
self.assertEqual(md5.md5(s).digest(),
hashlib.md5().digest())
if md5:
def test_md5_expected(self):
"""md5.md5().hexdigest() yields expected results"""
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(md5.md5(src).hexdigest(), MD5)
def test_md5_new_expected(self):
if md5.new is md5.md5:
return
else:
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(md5.new(src).hexdigest(), MD5)
if sha and hashlib:
if sha.sha is hashlib.sha1:
return
else:
- for s in self.testdata:
+ for s in self.data_for_test:
self.assertEqual(sha.sha(s).digest(),
hashlib.sha1().digest())
if sha:
def test_sha_expected(self):
"""sha.sha().hexdigest() yields expected results"""
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(sha.sha(src).hexdigest(), SHA)
# fails for me with Python 2.3; unittest module bug?
if sha.new is sha.sha:
return
else:
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(sha.new(src).hexdigest(), SHA)
if hashlib:
def test_sha1_expected_hashlib(self):
"""hashlib.sha1().hexdigest() yields expected results"""
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(hashlib.sha1(src).hexdigest(), SHA)
def test_md5_expected_hashlib(self):
"""hashlib.md5().hexdigest() yields expected results"""
- for src, SHA, MD5 in self.testdata:
+ for src, SHA, MD5 in self.data_for_test:
self.assertEqual(hashlib.md5(src).hexdigest(), MD5)
def test_suite():