Skip to content

Commit

Permalink
reduce shared test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Apr 7, 2012
1 parent 85ff63d commit 9da3eb3
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions src/Products/ZCatalog/tests/test_catalog.py
Expand Up @@ -175,32 +175,20 @@ def _make_one(self):
catalog = Catalog()
catalog.lexicon = PLexicon('lexicon')
col1 = FieldIndex('col1')
col2 = ZCTextIndex('col2', caller=catalog,
index_factory=OkapiIndex, lexicon_id='lexicon')
col3 = KeywordIndex('col3')

catalog.addIndex('col1', col1)
catalog.addIndex('col2', col2)
catalog.addIndex('col3', col3)
catalog.addColumn('col1')
catalog.addColumn('col2')
catalog.addColumn('col3')

att1 = FieldIndex('att1')
att2 = ZCTextIndex('att2', caller=catalog,
index_factory=OkapiIndex, lexicon_id='lexicon')
att3 = KeywordIndex('att3')
num = FieldIndex('num')
ends_in_zero = FieldIndex('ends_in_zero')

catalog.addIndex('col1', col1)
catalog.addIndex('att1', att1)
catalog.addIndex('att2', att2)
catalog.addIndex('att3', att3)
catalog.addIndex('num', num)
catalog.addIndex('ends_in_zero', ends_in_zero)
catalog.addColumn('att1')
catalog.addColumn('att2')
catalog.addColumn('att3')
catalog.addColumn('num')

for x in range(0, self.upper):
Expand Down Expand Up @@ -263,11 +251,12 @@ def test_sorted_search_indexes_many(self):
self.assertEquals(set(result), set(['att1', 'att2', 'num']))

def test_sorted_search_indexes_priority(self):
# att2 and col2 don't support ILimitedResultIndex, att1 does
# att2 doesn't support ILimitedResultIndex, att1 does
catalog = self._make_one()
query = {'att1': 'a', 'att2': 'b', 'col2': 'c'}
query = {'att1': 'a', 'att2': 'b'}
result = catalog._sorted_search_indexes(query)
self.assertEquals(result.index('att1'), 2)
self.assertEquals(result.index('att2'), 0)
self.assertEquals(result.index('att1'), 1)

# search

Expand Down

0 comments on commit 9da3eb3

Please sign in to comment.