Skip to content

Commit

Permalink
slightly more complex test for search of larse sets
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Gologuzov committed Oct 30, 2014
1 parent 82c4dd4 commit 73594f7
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,22 @@ def test_cw_result_in_different_tables(self):
self.assertIn(self.e4, found)

def test_more_items(self):
expected_count = 20
self.entry_list = [
self.Entry(title=u'foobar_{}'.format(x), content=u'xxxx', user=self.u1 )
for x in range(20)
]

self.db.session.add_all(self.entry_list)
self.db.session.commit()

found = self.Entry.query.whooshee_search('foobar').all()
assert len(found) == expected_count
expected_count = 0
# couldn't test for large set due to some bugs either in sqlite or whoosh or SA
# got: OperationalError: (OperationalError) too many SQL variables u'SELECT entry.id
# ... FROM entry \nWHERE entry.id IN (?, ?, .... when whooshee_search is invoked
for batch_size in [2, 5, 7, 20, 50, 300, 500]: # , 1000]:
expected_count += batch_size
self.entry_list = [
self.Entry(title=u'foobar_{}_{}'.format(expected_count, x),
content=u'xxxx', user=self.u1)
for x in range(batch_size)
]

self.db.session.add_all(self.entry_list)
self.db.session.commit()

found = self.Entry.query.whooshee_search('foobar').all()
assert len(found) == expected_count

# TODO: more :)

0 comments on commit 73594f7

Please sign in to comment.