Skip to content

Commit 9953fd3

Browse files
author
Richard Jones
committed
fixes to tests and Interval unmarshalling
1 parent 9cf389c commit 9953fd3

File tree

3 files changed

+13
-62
lines changed

3 files changed

+13
-62
lines changed

roundup/date.py

Lines changed: 11 additions & 5 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: date.py,v 1.26 2002-09-10 00:18:20 richard Exp $
18+
# $Id: date.py,v 1.27 2002-09-10 01:27:13 richard Exp $
1919

2020
__doc__ = """
2121
Date, time and time interval handling.
@@ -160,7 +160,8 @@ def __sub__(self, other):
160160
2. a date from this date to produce an interval.
161161
"""
162162
if isinstance(other, Interval):
163-
other = Interval(other.get_tuple(), sign=-other.sign)
163+
other = Interval(other.get_tuple())
164+
other.sign *= -1
164165
return self.__add__(other)
165166

166167
assert isinstance(other, Date), 'May only subtract Dates or Intervals'
@@ -315,9 +316,14 @@ def __init__(self, spec, sign=1):
315316
if type(spec) == type(''):
316317
self.set(spec)
317318
else:
318-
self.sign = sign
319-
self.year, self.month, self.day, self.hour, self.minute, \
320-
self.second = spec
319+
if len(spec) == 7:
320+
self.sign, self.year, self.month, self.day, self.hour, \
321+
self.minute, self.second = spec
322+
else:
323+
# old, buggy spec form
324+
self.sign = sign
325+
self.year, self.month, self.day, self.hour, self.minute, \
326+
self.second = spec
321327

322328
def __cmp__(self, other):
323329
"""Compare this interval to another interval."""

test/test_init.py

Lines changed: 1 addition & 52 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: test_init.py,v 1.16 2002-09-10 00:19:54 richard Exp $
18+
# $Id: test_init.py,v 1.17 2002-09-10 01:27:13 richard Exp $
1919

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

@@ -68,86 +68,35 @@ def testCreation(self):
6868
l = db.issue.list()
6969
ae(l, [])
7070

71-
class ExtendedTestCase(MyTestCase):
72-
backend = 'anydbm'
73-
def testCreation(self):
74-
ae = self.assertEqual
75-
76-
# create the instance
77-
init.install(self.dirname, 'extended', self.backend)
78-
init.initialise(self.dirname, 'sekrit')
79-
80-
# check we can load the package
81-
instance = imp.load_package(self.dirname, self.dirname)
82-
83-
# and open the database
84-
db = instance.open()
85-
86-
# check the basics of the schema and initial data set
87-
l = db.priority.list()
88-
ae(l, ['1', '2', '3', '4'])
89-
l = db.status.list()
90-
ae(l, ['1', '2', '3', '4', '5', '6', '7', '8'])
91-
l = db.keyword.list()
92-
ae(l, [])
93-
l = db.user.list()
94-
ae(l, ['1', '2'])
95-
l = db.msg.list()
96-
ae(l, [])
97-
l = db.file.list()
98-
ae(l, [])
99-
l = db.issue.list()
100-
ae(l, [])
101-
l = db.support.list()
102-
ae(l, [])
103-
l = db.rate.list()
104-
ae(l, ['1', '2', '3'])
105-
l = db.source.list()
106-
ae(l, ['1', '2', '3', '4'])
107-
l = db.platform.list()
108-
ae(l, ['1', '2', '3'])
109-
l = db.timelog.list()
110-
ae(l, [])
111-
11271
class bsddbClassicTestCase(ClassicTestCase):
11372
backend = 'bsddb'
114-
class bsddbExtendedTestCase(ExtendedTestCase):
115-
backend = 'bsddb'
11673

11774
class bsddb3ClassicTestCase(ClassicTestCase):
11875
backend = 'bsddb3'
119-
class bsddb3ExtendedTestCase(ExtendedTestCase):
120-
backend = 'bsddb3'
12176

12277
class metakitClassicTestCase(ClassicTestCase):
12378
backend = 'metakit'
124-
class metakitExtendedTestCase(ExtendedTestCase):
125-
backend = 'metakit'
12679

12780
def suite():
12881
l = [
12982
unittest.makeSuite(ClassicTestCase, 'test'),
130-
unittest.makeSuite(ExtendedTestCase, 'test')
13183
]
13284

13385
try:
13486
import bsddb
13587
l.append(unittest.makeSuite(bsddbClassicTestCase, 'test'))
136-
l.append(unittest.makeSuite(bsddbExtendedTestCase, 'test'))
13788
except:
13889
print 'bsddb module not found, skipping bsddb DBTestCase'
13990

14091
try:
14192
import bsddb3
14293
l.append(unittest.makeSuite(bsddb3ClassicTestCase, 'test'))
143-
l.append(unittest.makeSuite(bsddb3ExtendedTestCase, 'test'))
14494
except:
14595
print 'bsddb3 module not found, skipping bsddb3 DBTestCase'
14696

14797
try:
14898
import metakit
14999
l.append(unittest.makeSuite(metakitClassicTestCase, 'test'))
150-
l.append(unittest.makeSuite(metakitExtendedTestCase, 'test'))
151100
except:
152101
print 'metakit module not found, skipping metakit DBTestCase'
153102

test/test_mailgw.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# but WITHOUT ANY WARRANTY; without even the implied warranty of
99
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010
#
11-
# $Id: test_mailgw.py,v 1.27 2002-09-10 00:19:54 richard Exp $
11+
# $Id: test_mailgw.py,v 1.28 2002-09-10 01:27:13 richard Exp $
1212

1313
import unittest, cStringIO, tempfile, os, shutil, errno, imp, sys, difflib
1414

@@ -769,12 +769,8 @@ def testMultipartEnc01(self):
769769
_________________________________________________________________________
770770
''')
771771

772-
class ExtMailgwTestCase(MailgwTestCase):
773-
schema = 'extended'
774-
775772
def suite():
776773
l = [unittest.makeSuite(MailgwTestCase),
777-
unittest.makeSuite(ExtMailgwTestCase, 'test')
778774
]
779775
return unittest.TestSuite(l)
780776

0 commit comments

Comments
 (0)