Skip to content

Commit 7422abd

Browse files
author
Gordon B. McMillan
committed
Remove some assumptions about what idi numbers will be created.
1 parent abbc2c6 commit 7422abd

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

test/test_db.py

Lines changed: 14 additions & 13 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_db.py,v 1.52 2002-09-20 05:08:00 richard Exp $
18+
# $Id: test_db.py,v 1.53 2002-09-20 19:26:28 gmcm Exp $
1919

2020
import unittest, os, shutil, time
2121

@@ -314,35 +314,35 @@ def testExceptions(self):
314314
# class get
315315
#
316316
# invalid node id
317-
ar(IndexError, self.db.issue.get, '1', 'title')
317+
ar(IndexError, self.db.issue.get, '99', 'title')
318318
# invalid property name
319319
ar(KeyError, self.db.status.get, '2', 'foo')
320320

321321
#
322322
# class set
323323
#
324324
# invalid node id
325-
ar(IndexError, self.db.issue.set, '1', title='foo')
325+
ar(IndexError, self.db.issue.set, '99', title='foo')
326326
# invalid property name
327327
ar(KeyError, self.db.status.set, '1', foo='foo')
328328
# string property
329329
ar(TypeError, self.db.status.set, '1', name=1)
330330
# key name clash
331331
ar(ValueError, self.db.status.set, '2', name='unread')
332332
# set up a valid issue for me to work on
333-
self.db.issue.create(title="spam", status='1')
333+
id = self.db.issue.create(title="spam", status='1')
334334
# invalid link index
335-
ar(IndexError, self.db.issue.set, '6', title='foo', status='bar')
335+
ar(IndexError, self.db.issue.set, id, title='foo', status='bar')
336336
# invalid link value
337-
ar(ValueError, self.db.issue.set, '6', title='foo', status=1)
337+
ar(ValueError, self.db.issue.set, id, title='foo', status=1)
338338
# invalid multilink type
339-
ar(TypeError, self.db.issue.set, '6', title='foo', status='1',
339+
ar(TypeError, self.db.issue.set, id, title='foo', status='1',
340340
nosy='hello')
341341
# invalid multilink index type
342-
ar(ValueError, self.db.issue.set, '6', title='foo', status='1',
342+
ar(ValueError, self.db.issue.set, id, title='foo', status='1',
343343
nosy=[1])
344344
# invalid multilink index
345-
ar(IndexError, self.db.issue.set, '6', title='foo', status='1',
345+
ar(IndexError, self.db.issue.set, id, title='foo', status='1',
346346
nosy=['10'])
347347
# invalid number value
348348
ar(TypeError, self.db.user.create, username='foo', age='a')
@@ -422,22 +422,23 @@ def testJournals(self):
422422
self.assertNotEqual(date_stamp, date_stamp2)
423423

424424
def testPack(self):
425-
self.db.issue.create(title="spam", status='1')
425+
id = self.db.issue.create(title="spam", status='1')
426426
self.db.commit()
427-
self.db.issue.set('1', status='2')
427+
self.db.issue.set(id, status='2')
428428
self.db.commit()
429429

430430
# sleep for at least a second, then get a date to pack at
431431
time.sleep(1)
432432
pack_before = date.Date('.')
433+
time.sleep(1)
433434

434435
# one more entry
435-
self.db.issue.set('1', status='3')
436+
self.db.issue.set(id, status='3')
436437
self.db.commit()
437438

438439
# pack
439440
self.db.pack(pack_before)
440-
journal = self.db.getjournal('issue', '1')
441+
journal = self.db.getjournal('issue', id)
441442

442443
# we should have the create and last set entries now
443444
self.assertEqual(2, len(journal))

0 commit comments

Comments
 (0)