comparison test/db_test_base.py @ 2102:666402433998

Fix some tests.
author Richard Jones <richard@users.sourceforge.net>
date Wed, 24 Mar 2004 04:57:25 +0000
parents 18addf2a8596
children c52a931879c4
comparison
equal deleted inserted replaced
2101:e63ff40b097a 2102:666402433998
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: db_test_base.py,v 1.19 2004-03-22 07:45:40 richard Exp $ 18 # $Id: db_test_base.py,v 1.20 2004-03-24 04:57:25 richard Exp $
19 19
20 import unittest, os, shutil, errno, imp, sys, time, pprint 20 import unittest, os, shutil, errno, imp, sys, time, pprint
21 21
22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \
23 Interval, DatabaseError, Boolean, Number, Node 23 Interval, DatabaseError, Boolean, Number, Node
937 self.db.setid(cn, str(maxid+1)) 937 self.db.setid(cn, str(maxid+1))
938 938
939 # compare with snapshot of the database 939 # compare with snapshot of the database
940 for cn, items in orig.items(): 940 for cn, items in orig.items():
941 klass = self.db.classes[cn] 941 klass = self.db.classes[cn]
942 propdefs = klass.getprops(1)
942 # ensure retired items are retired :) 943 # ensure retired items are retired :)
943 l = items.keys(); l.sort() 944 l = items.keys(); l.sort()
944 m = klass.list(); m.sort() 945 m = klass.list(); m.sort()
945 ae(l, m) 946 ae(l, m)
946 for id, props in items.items(): 947 for id, props in items.items():
947 for name, value in props.items(): 948 for name, value in props.items():
948 l = klass.get(id, name) 949 l = klass.get(id, name)
949 if isinstance(value, type([])): 950 if isinstance(value, type([])):
950 value.sort() 951 value.sort()
951 l.sort() 952 l.sort()
952 ae(l, value) 953 try:
954 ae(l, value)
955 except AssertionError:
956 if not isinstance(propdefs[name], Date):
957 raise
958 # don't get hung up on rounding errors
959 assert not l.__cmp__(value, int_seconds=1)
953 960
954 # make sure the retired items are actually imported 961 # make sure the retired items are actually imported
955 ae(self.db.user.get('4', 'username'), 'blop') 962 ae(self.db.user.get('4', 'username'), 'blop')
956 ae(self.db.issue.get('2', 'title'), 'issue two') 963 ae(self.db.issue.get('2', 'title'), 'issue two')
957 964

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