comparison test/db_test_base.py @ 5481:9a09719b0d8e

helper to allow comparing dicts and None values in Python 3
author Christof Meerwald <cmeerw@cmeerw.org>
date Wed, 01 Aug 2018 22:03:50 +0100
parents b0048969990d
children 52cb53eedf77
comparison
equal deleted inserted replaced
5480:e8f6a1df73e3 5481:9a09719b0d8e
33 from roundup.cgi.engine_zopetal import RoundupPageTemplate 33 from roundup.cgi.engine_zopetal import RoundupPageTemplate
34 from roundup.cgi.templating import HTMLItem 34 from roundup.cgi.templating import HTMLItem
35 from roundup.exceptions import UsageError, Reject 35 from roundup.exceptions import UsageError, Reject
36 36
37 from roundup.anypy.strings import b2s, s2b, u2s 37 from roundup.anypy.strings import b2s, s2b, u2s
38 from roundup.anypy.cmp_ import NoneAndDictComparable
38 39
39 from .mocknull import MockNull 40 from .mocknull import MockNull
40 41
41 config = configuration.CoreConfig() 42 config = configuration.CoreConfig()
42 config.DATABASE = "db" 43 config.DATABASE = "db"
2308 # the integer part. 2309 # the integer part.
2309 for j in oj: 2310 for j in oj:
2310 j[1].second = float(int(j[1].second)) 2311 j[1].second = float(int(j[1].second))
2311 for j in rj: 2312 for j in rj:
2312 j[1].second = float(int(j[1].second)) 2313 j[1].second = float(int(j[1].second))
2313 oj.sort(key = lambda x: x[:4]) 2314 oj.sort(key = NoneAndDictComparable)
2314 rj.sort(key = lambda x: x[:4]) 2315 rj.sort(key = NoneAndDictComparable)
2315 ae(oj, rj) 2316 ae(oj, rj)
2316 2317
2317 # make sure the retired items are actually imported 2318 # make sure the retired items are actually imported
2318 ae(self.db.user.get('4', 'username'), 'blop') 2319 ae(self.db.user.get('4', 'username'), 'blop')
2319 ae(self.db.issue.get('2', 'title'), 'issue two') 2320 ae(self.db.issue.get('2', 'title'), 'issue two')

Roundup Issue Tracker: http://roundup-tracker.org/