From be99dcf9adf85cbfa8aa04c460a55134ec623a84 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 10 Dec 2003 01:40:51 +0000 Subject: [PATCH] more unit tests, fixes and cleanups git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2022 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 1 + roundup/backends/back_anydbm.py | 26 ++------------------------ test/db_test_base.py | 7 ++++--- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 9e67f79..3321df3 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -57,6 +57,7 @@ Cleanup: - use FormError in client.py, moving the handling up to inner_main(). - implemented semantic comparison of Message objects in test_mailgw. + 2003-??-?? 0.6.4 Fixed: - fixed date arithmetic to not allow day-of-month == 0 (sf bug 853306) diff --git a/roundup/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index 090965e..6450b26 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.133 2003-12-05 09:47:46 richard Exp $ +#$Id: back_anydbm.py,v 1.134 2003-12-10 01:40:51 richard Exp $ ''' This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python @@ -1630,21 +1630,12 @@ class Class(hyperdb.Class): if isinstance(propclass, Link): if type(v) is not type([]): v = [v] - # replace key values with node ids u = [] - link_class = self.db.classes[propclass.classname] for entry in v: # the value -1 is a special "not set" sentinel if entry == '-1': entry = None - elif not num_re.match(entry): - try: - entry = link_class.lookup(entry) - except (TypeError,KeyError): - raise ValueError, 'property "%s": %s not a %s'%( - k, entry, self.properties[k].classname) u.append(entry) - l.append((LINK, k, u)) elif isinstance(propclass, Multilink): # the value -1 is a special "not set" sentinel @@ -1652,20 +1643,7 @@ class Class(hyperdb.Class): v = [] elif type(v) is not type([]): v = [v] - - # replace key values with node ids - u = [] - link_class = self.db.classes[propclass.classname] - for entry in v: - if not num_re.match(entry): - try: - entry = link_class.lookup(entry) - except (TypeError,KeyError): - raise ValueError, 'new property "%s": %s not a %s'%( - k, entry, self.properties[k].classname) - u.append(entry) - u.sort() - l.append((MULTILINK, k, u)) + l.append((MULTILINK, k, v)) elif isinstance(propclass, String) and k != 'id': if type(v) is not type([]): v = [v] diff --git a/test/db_test_base.py b/test/db_test_base.py index 681cf4f..ed707ab 100644 --- a/test/db_test_base.py +++ b/test/db_test_base.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: db_test_base.py,v 1.11 2003-12-05 09:47:46 richard Exp $ +# $Id: db_test_base.py,v 1.12 2003-12-10 01:40:51 richard Exp $ import unittest, os, shutil, errno, imp, sys, time, pprint @@ -695,10 +695,10 @@ class DBTest(MyTestCase): self.db.user.create(**user) iss = self.db.issue for issue in ( - {'title': 'issue one', 'status': '2', + {'title': 'issue one', 'status': '2', 'assignedto': '1', 'foo': date.Interval('1:10'), 'deadline': date.Date('2003-01-01.00:00')}, - {'title': 'issue two', 'status': '1', + {'title': 'issue two', 'status': '1', 'assignedto': '2', 'foo': date.Interval('1d'), 'deadline': date.Date('2003-02-16.22:50')}, {'title': 'issue three', 'status': '1', @@ -725,6 +725,7 @@ class DBTest(MyTestCase): def testFilteringLink(self): ae, filt = self.filteringSetup() ae(filt(None, {'status': '1'}, ('+','id'), (None,None)), ['2','3']) + ae(filt(None, {'assignedto': '-1'}, ('+','id'), (None,None)), ['3','4']) def testFilteringRetired(self): ae, filt = self.filteringSetup() -- 2.30.2