Mercurial > p > roundup > code
comparison test/test_indexer.py @ 4015:6eec11b197aa
fix for indexer-test:
Old version fails for me on Debian Etch with sqlite 2.8.17-2.
| author | Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net> |
|---|---|
| date | Thu, 11 Sep 2008 18:48:07 +0000 |
| parents | 0bf9f8ae7d1b |
| children | 96a5e0845adb |
comparison
equal
deleted
inserted
replaced
| 4014:b80224c1f4e3 | 4015:6eec11b197aa |
|---|---|
| 16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 # SOFTWARE. | 19 # SOFTWARE. |
| 20 | 20 |
| 21 # $Id: test_indexer.py,v 1.11 2008-09-01 00:43:02 richard Exp $ | 21 # $Id: test_indexer.py,v 1.12 2008-09-11 18:48:07 schlatterbeck Exp $ |
| 22 | 22 |
| 23 import os, unittest, shutil | 23 import os, unittest, shutil |
| 24 | 24 |
| 25 from roundup.backends import get_backend, have_backend | 25 from roundup.backends import get_backend, have_backend |
| 26 from roundup.backends.indexer_rdbms import Indexer | 26 from roundup.backends.indexer_rdbms import Indexer |
| 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 desired result | 51 # first argument is the db result we're testing, second is the |
| 52 # some db results don't have iterable rows, so we have to work around that | 52 # desired result some db results don't have iterable rows, so we |
| 53 if [i for x,y in zip(s1, s2) for i,j in enumerate(y) if x[i] != j]: | 53 # have to work around that |
| 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. | |
| 56 s1 = list(s1) | |
| 57 s1.sort() | |
| 58 if s1 != s2: | |
| 54 self.fail('contents of %r != %r'%(s1, s2)) | 59 self.fail('contents of %r != %r'%(s1, s2)) |
| 55 | 60 |
| 56 def test_basics(self): | 61 def test_basics(self): |
| 57 self.dex.add_text(('test', '1', 'foo'), 'a the hello world') | 62 self.dex.add_text(('test', '1', 'foo'), 'a the hello world') |
| 58 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world') | 63 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world') |
