Skip to content

Commit 9515867

Browse files
author
Richard Jones
committed
more unit tests, fixes and cleanups
1 parent e061dee commit 9515867

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Cleanup:
5757
- use FormError in client.py, moving the handling up to inner_main().
5858
- implemented semantic comparison of Message objects in test_mailgw.
5959

60+
6061
2003-??-?? 0.6.4
6162
Fixed:
6263
- fixed date arithmetic to not allow day-of-month == 0 (sf bug 853306)

roundup/backends/back_anydbm.py

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.133 2003-12-05 09:47:46 richard Exp $
18+
#$Id: back_anydbm.py,v 1.134 2003-12-10 01:40:51 richard Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -1630,42 +1630,20 @@ def filter(self, search_matches, filterspec, sort=(None,None),
16301630
if isinstance(propclass, Link):
16311631
if type(v) is not type([]):
16321632
v = [v]
1633-
# replace key values with node ids
16341633
u = []
1635-
link_class = self.db.classes[propclass.classname]
16361634
for entry in v:
16371635
# the value -1 is a special "not set" sentinel
16381636
if entry == '-1':
16391637
entry = None
1640-
elif not num_re.match(entry):
1641-
try:
1642-
entry = link_class.lookup(entry)
1643-
except (TypeError,KeyError):
1644-
raise ValueError, 'property "%s": %s not a %s'%(
1645-
k, entry, self.properties[k].classname)
16461638
u.append(entry)
1647-
16481639
l.append((LINK, k, u))
16491640
elif isinstance(propclass, Multilink):
16501641
# the value -1 is a special "not set" sentinel
16511642
if v in ('-1', ['-1']):
16521643
v = []
16531644
elif type(v) is not type([]):
16541645
v = [v]
1655-
1656-
# replace key values with node ids
1657-
u = []
1658-
link_class = self.db.classes[propclass.classname]
1659-
for entry in v:
1660-
if not num_re.match(entry):
1661-
try:
1662-
entry = link_class.lookup(entry)
1663-
except (TypeError,KeyError):
1664-
raise ValueError, 'new property "%s": %s not a %s'%(
1665-
k, entry, self.properties[k].classname)
1666-
u.append(entry)
1667-
u.sort()
1668-
l.append((MULTILINK, k, u))
1646+
l.append((MULTILINK, k, v))
16691647
elif isinstance(propclass, String) and k != 'id':
16701648
if type(v) is not type([]):
16711649
v = [v]

test/db_test_base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: db_test_base.py,v 1.11 2003-12-05 09:47:46 richard Exp $
18+
# $Id: db_test_base.py,v 1.12 2003-12-10 01:40:51 richard Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys, time, pprint
2121

@@ -695,10 +695,10 @@ def filteringSetup(self):
695695
self.db.user.create(**user)
696696
iss = self.db.issue
697697
for issue in (
698-
{'title': 'issue one', 'status': '2',
698+
{'title': 'issue one', 'status': '2', 'assignedto': '1',
699699
'foo': date.Interval('1:10'),
700700
'deadline': date.Date('2003-01-01.00:00')},
701-
{'title': 'issue two', 'status': '1',
701+
{'title': 'issue two', 'status': '1', 'assignedto': '2',
702702
'foo': date.Interval('1d'),
703703
'deadline': date.Date('2003-02-16.22:50')},
704704
{'title': 'issue three', 'status': '1',
@@ -725,6 +725,7 @@ def testFilteringString(self):
725725
def testFilteringLink(self):
726726
ae, filt = self.filteringSetup()
727727
ae(filt(None, {'status': '1'}, ('+','id'), (None,None)), ['2','3'])
728+
ae(filt(None, {'assignedto': '-1'}, ('+','id'), (None,None)), ['3','4'])
728729

729730
def testFilteringRetired(self):
730731
ae, filt = self.filteringSetup()

0 commit comments

Comments
 (0)