Mercurial > p > roundup > code
diff test/db_test_base.py @ 4089:eddb82d0964c
Add compatibility package to allow us to deal with Python versions 2.3..2.6.
Outstanding issues noted in roundup/anypy/TODO.txt
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 12 Mar 2009 02:52:56 +0000 |
| parents | 5eb5f7e66c37 |
| children | dcca66d56815 |
line wrap: on
line diff
--- a/test/db_test_base.py Thu Mar 12 02:25:03 2009 +0000 +++ b/test/db_test_base.py Thu Mar 12 02:52:56 2009 +0000 @@ -17,7 +17,9 @@ # # $Id: db_test_base.py,v 1.101 2008-08-19 01:40:59 richard Exp $ -import unittest, os, shutil, errno, imp, sys, time, pprint, sets, base64, os.path +import unittest, os, shutil, errno, imp, sys, time, pprint, base64, os.path +# Python 2.3 ... 2.6 compatibility: +from roundup.anypy.sets_ import set from roundup.hyperdb import String, Password, Link, Multilink, Date, \ Interval, DatabaseError, Boolean, Number, Node @@ -284,7 +286,7 @@ # try a couple of the built-in iterable types to make # sure that we accept them and handle them properly # try a set as input for the multilink - nid = self.db.issue.create(title="spam", nosy=sets.Set(u1)) + nid = self.db.issue.create(title="spam", nosy=set(u1)) if commit: self.db.commit() self.assertEqual(self.db.issue.get(nid, "nosy"), [u1]) self.assertRaises(TypeError, self.db.issue.set, nid, @@ -294,7 +296,7 @@ if commit: self.db.commit() self.assertEqual(self.db.issue.get(nid, "nosy"), []) # make sure we accept a frozen set - self.db.issue.set(nid, nosy=sets.Set([u1,u2])) + self.db.issue.set(nid, nosy=set([u1,u2])) if commit: self.db.commit() l = [u1,u2]; l.sort() m = self.db.issue.get(nid, "nosy"); m.sort() @@ -487,12 +489,12 @@ others = nodeids[:] others.remove('1') - self.assertEqual(sets.Set(self.db.status.getnodeids()), - sets.Set(nodeids)) - self.assertEqual(sets.Set(self.db.status.getnodeids(retired=True)), - sets.Set(['1'])) - self.assertEqual(sets.Set(self.db.status.getnodeids(retired=False)), - sets.Set(others)) + self.assertEqual(set(self.db.status.getnodeids()), + set(nodeids)) + self.assertEqual(set(self.db.status.getnodeids(retired=True)), + set(['1'])) + self.assertEqual(set(self.db.status.getnodeids(retired=False)), + set(others)) self.assert_(self.db.status.is_retired('1')) @@ -2054,7 +2056,7 @@ self.db.getjournal('a', aid) class RDBMSTest: - ''' tests specific to RDBMS backends ''' + """ tests specific to RDBMS backends """ def test_indexTest(self): self.assertEqual(self.db.sql_index_exists('_issue', '_issue_id_idx'), 1) self.assertEqual(self.db.sql_index_exists('_issue', '_issue_x_idx'), 0)
