Mercurial > p > roundup > code
comparison test/db_test_base.py @ 2873:49d1fd44881a maint-0.7
merge from HEAD
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 05 Nov 2004 05:11:25 +0000 |
| parents | 572746c94537 |
| children | 7922e1244911 |
comparison
equal
deleted
inserted
replaced
| 2871:1629b3e303d2 | 2873:49d1fd44881a |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: db_test_base.py,v 1.27.2.11 2004-10-08 00:21:31 richard Exp $ | 18 # $Id: db_test_base.py,v 1.27.2.12 2004-11-05 05:11:25 richard Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint | 20 import unittest, os, shutil, errno, imp, sys, time, pprint |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 652 f1 = self.db.file.create(content='hello', type="text/plain") | 652 f1 = self.db.file.create(content='hello', type="text/plain") |
| 653 # content='world' has the wrong content-type and won't be indexed | 653 # content='world' has the wrong content-type and won't be indexed |
| 654 f2 = self.db.file.create(content='world', type="text/frozz", | 654 f2 = self.db.file.create(content='world', type="text/frozz", |
| 655 comment='blah blah') | 655 comment='blah blah') |
| 656 i1 = self.db.issue.create(files=[f1, f2], title="flebble plop") | 656 i1 = self.db.issue.create(files=[f1, f2], title="flebble plop") |
| 657 i2 = self.db.issue.create(title="flebble frooz") | 657 i2 = self.db.issue.create(title="flebble the frooz") |
| 658 self.db.commit() | 658 self.db.commit() |
| 659 self.assertEquals(self.db.indexer.search(['hello'], self.db.issue), | 659 self.assertEquals(self.db.indexer.search(['hello'], self.db.issue), |
| 660 {i1: {'files': [f1]}}) | 660 {i1: {'files': [f1]}}) |
| 661 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {}) | 661 self.assertEquals(self.db.indexer.search(['world'], self.db.issue), {}) |
| 662 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), | 662 self.assertEquals(self.db.indexer.search(['frooz'], self.db.issue), |
| 663 {i2: {}}) | 663 {i2: {}}) |
| 664 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), | 664 self.assertEquals(self.db.indexer.search(['flebble'], self.db.issue), |
| 665 {i1: {}, i2: {}}) | 665 {i1: {}, i2: {}}) |
| 666 | |
| 667 # unindexed stopword | |
| 668 self.assertEquals(self.db.indexer.search(['the'], self.db.issue), {}) | |
| 666 | 669 |
| 667 def testReindexing(self): | 670 def testReindexing(self): |
| 668 search = self.db.indexer.search | 671 search = self.db.indexer.search |
| 669 issue = self.db.issue | 672 issue = self.db.issue |
| 670 i1 = issue.create(title="flebble plop") | 673 i1 = issue.create(title="flebble plop") |
