Skip to content

Commit bf31b73

Browse files
committed
fix tests for Python 3
don't pass bytes as title don't try to compare dicts don't compare int and string
1 parent 9291b29 commit bf31b73

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

test/db_test_base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
from roundup.cgi.templating import HTMLItem
3535
from roundup.exceptions import UsageError, Reject
3636

37+
from roundup.anypy.strings import u2s
38+
3739
from .mocknull import MockNull
3840

3941
config = configuration.CoreConfig()
@@ -285,12 +287,12 @@ def testFileClassContentChange(self):
285287

286288
def testStringUnicode(self):
287289
# test set & retrieve
288-
ustr = u'\xe4\xf6\xfc\u20ac'.encode('utf8')
290+
ustr = u2s(u'\xe4\xf6\xfc\u20ac')
289291
nid = self.db.issue.create(title=ustr, status='1')
290292
self.assertEqual(self.db.issue.get(nid, 'title'), ustr)
291293

292294
# change and make sure we retrieve the correct value
293-
ustr2 = u'change \u20ac change'.encode('utf8')
295+
ustr2 = u2s(u'change \u20ac change')
294296
self.db.issue.set(nid, title=ustr2)
295297
self.db.commit()
296298
self.assertEqual(self.db.issue.get(nid, 'title'), ustr2)
@@ -2308,8 +2310,8 @@ def testImportExport(self):
23082310
j[1].second = float(int(j[1].second))
23092311
for j in rj:
23102312
j[1].second = float(int(j[1].second))
2311-
oj.sort()
2312-
rj.sort()
2313+
oj.sort(key = lambda x: x[:4])
2314+
rj.sort(key = lambda x: x[:4])
23132315
ae(oj, rj)
23142316

23152317
# make sure the retired items are actually imported
@@ -2318,7 +2320,7 @@ def testImportExport(self):
23182320

23192321
# make sure id counters are set correctly
23202322
maxid = max([int(id) for id in self.db.user.list()])
2321-
newid = self.db.user.create(username='testing')
2323+
newid = int(self.db.user.create(username='testing'))
23222324
assert newid > maxid
23232325

23242326
# test import/export via admin interface

0 commit comments

Comments
 (0)