Mercurial > p > roundup > code
changeset 5468:0cde8a595893
fix tests for Python 3
don't pass bytes as title
don't try to compare dicts
don't compare int and string
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Sat, 28 Jul 2018 22:01:46 +0100 |
| parents | 630a00b20394 |
| children | 115efa91f7a1 |
| files | test/db_test_base.py |
| diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/test/db_test_base.py Sat Jul 28 20:41:06 2018 +0100 +++ b/test/db_test_base.py Sat Jul 28 22:01:46 2018 +0100 @@ -34,6 +34,8 @@ from roundup.cgi.templating import HTMLItem from roundup.exceptions import UsageError, Reject +from roundup.anypy.strings import u2s + from .mocknull import MockNull config = configuration.CoreConfig() @@ -285,12 +287,12 @@ def testStringUnicode(self): # test set & retrieve - ustr = u'\xe4\xf6\xfc\u20ac'.encode('utf8') + ustr = u2s(u'\xe4\xf6\xfc\u20ac') nid = self.db.issue.create(title=ustr, status='1') self.assertEqual(self.db.issue.get(nid, 'title'), ustr) # change and make sure we retrieve the correct value - ustr2 = u'change \u20ac change'.encode('utf8') + ustr2 = u2s(u'change \u20ac change') self.db.issue.set(nid, title=ustr2) self.db.commit() self.assertEqual(self.db.issue.get(nid, 'title'), ustr2) @@ -2308,8 +2310,8 @@ j[1].second = float(int(j[1].second)) for j in rj: j[1].second = float(int(j[1].second)) - oj.sort() - rj.sort() + oj.sort(key = lambda x: x[:4]) + rj.sort(key = lambda x: x[:4]) ae(oj, rj) # make sure the retired items are actually imported @@ -2318,7 +2320,7 @@ # make sure id counters are set correctly maxid = max([int(id) for id in self.db.user.list()]) - newid = self.db.user.create(username='testing') + newid = int(self.db.user.create(username='testing')) assert newid > maxid # test import/export via admin interface
