comparison test/test_indexer.py @ 3547:7728ee93efd2

fix reindexing in Xapian
author Richard Jones <richard@users.sourceforge.net>
date Tue, 07 Feb 2006 04:59:05 +0000
parents a4edd24c32be
children 0bf9f8ae7d1b
comparison
equal deleted inserted replaced
3546:a4edd24c32be 3547:7728ee93efd2
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.9 2006-02-07 04:14:32 richard Exp $ 21 # $Id: test_indexer.py,v 1.10 2006-02-07 04:59:05 richard Exp $
22 22
23 import os, unittest, shutil 23 import os, unittest, shutil
24 24
25 class db: 25 class db:
26 class config(dict): 26 class config(dict):
44 self.assertEqual(self.dex.find(['world']), [('test', '1', 'foo'), 44 self.assertEqual(self.dex.find(['world']), [('test', '1', 'foo'),
45 ('test', '2', 'foo')]) 45 ('test', '2', 'foo')])
46 self.assertEqual(self.dex.find(['blah']), [('test', '2', 'foo')]) 46 self.assertEqual(self.dex.find(['blah']), [('test', '2', 'foo')])
47 self.assertEqual(self.dex.find(['blah', 'hello']), []) 47 self.assertEqual(self.dex.find(['blah', 'hello']), [])
48 48
49 # change 49 def test_change(self):
50 self.dex.add_text(('test', '1', 'foo'), 'a the hello world')
51 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world')
52 self.assertEqual(self.dex.find(['world']), [('test', '1', 'foo'),
53 ('test', '2', 'foo')])
50 self.dex.add_text(('test', '1', 'foo'), 'a the hello') 54 self.dex.add_text(('test', '1', 'foo'), 'a the hello')
55 self.assertEqual(self.dex.find(['world']), [('test', '2', 'foo')])
56
57 def test_clear(self):
58 self.dex.add_text(('test', '1', 'foo'), 'a the hello world')
59 self.dex.add_text(('test', '2', 'foo'), 'blah blah the world')
60 self.assertEqual(self.dex.find(['world']), [('test', '1', 'foo'),
61 ('test', '2', 'foo')])
62 self.dex.add_text(('test', '1', 'foo'), '')
51 self.assertEqual(self.dex.find(['world']), [('test', '2', 'foo')]) 63 self.assertEqual(self.dex.find(['world']), [('test', '2', 'foo')])
52 64
53 def tearDown(self): 65 def tearDown(self):
54 shutil.rmtree('test-index') 66 shutil.rmtree('test-index')
55 67

Roundup Issue Tracker: http://roundup-tracker.org/