Mercurial > p > roundup > code
comparison test/test_indexer.py @ 4102:dcca66d56815
fix unit test compatibility
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 13 Mar 2009 03:31:30 +0000 |
| parents | 96a5e0845adb |
| children | 2b1241daaa20 |
comparison
equal
deleted
inserted
replaced
| 4101:0388a5926974 | 4102:dcca66d56815 |
|---|---|
| 46 from roundup.backends.indexer_dbm import Indexer | 46 from roundup.backends.indexer_dbm import Indexer |
| 47 self.dex = Indexer(db) | 47 self.dex = Indexer(db) |
| 48 self.dex.load_index() | 48 self.dex.load_index() |
| 49 | 49 |
| 50 def assertSeqEqual(self, s1, s2): | 50 def assertSeqEqual(self, s1, s2): |
| 51 # first argument is the db result we're testing, second is the | 51 # First argument is the db result we're testing, second is the |
| 52 # desired result some db results don't have iterable rows, so we | 52 # desired result. Some db results don't have iterable rows, so we |
| 53 # have to work around that | 53 # have to work around that. |
| 54 # Also work around some dbs not returning items in the expected | 54 # Also work around some dbs not returning items in the expected |
| 55 # order. This would be *so* much easier with python2.4's sorted. | 55 # order. |
| 56 s1 = list(s1) | 56 s1 = list([tuple([r[n] for n in range(len(r))]) for r in s1]) |
| 57 s1.sort() | 57 s1.sort() |
| 58 if [i for x,y in zip(s1, s2) for i,j in enumerate(y) if x[i] != j]: | 58 if s1 != s2: |
| 59 self.fail('contents of %r != %r'%(s1, s2)) | 59 self.fail('contents of %r != %r'%(s1, s2)) |
| 60 | 60 |
| 61 def test_basics(self): | 61 def test_basics(self): |
| 62 self.dex.add_text(('test', '1', 'foo'), 'a the hello world') | 62 self.dex.add_text(('test', '1', 'foo'), 'a the hello world') |
| 63 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world') | 63 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world') |
