Skip to content

Commit

Permalink
Fix catalog test for caching support
Browse files Browse the repository at this point in the history
  • Loading branch information
andbag committed Oct 14, 2016
1 parent 9dc43bb commit c342d31
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/Products/ZCatalog/tests/test_catalog.py
Expand Up @@ -12,6 +12,7 @@
##############################################################################

import unittest
from zope.testing import cleanup

from itertools import chain
import random
Expand All @@ -32,6 +33,9 @@ def __init__(self, num):
def title(self):
return '%d' % self.num

def getPhysicalPath(self):
return ['/', self.title]


class Dummy(ExtensionClass.Base):

Expand Down Expand Up @@ -351,7 +355,7 @@ def test_keyword_index_length(self):
self.assertEqual(len(a), 0)


class TestCatalogSortBatch(unittest.TestCase):
class TestCatalogSortBatch(cleanup.CleanUp, unittest.TestCase):

upper = 100

Expand Down Expand Up @@ -920,7 +924,7 @@ def test_range_search(self):
"%d vs [%d,%d]" % (r.number, m, n))


class TestMergeResults(unittest.TestCase):
class TestMergeResults(cleanup.CleanUp, unittest.TestCase):

def _make_one(self):
from Products.ZCatalog.Catalog import Catalog
Expand All @@ -929,16 +933,17 @@ def _make_one(self):
def _make_many(self):
from Products.ZCatalog.Catalog import mergeResults
catalogs = []
for i in range(3):
for ci in range(3):
cat = self._make_one()
cat.lexicon = PLexicon('lexicon')
cat.addIndex('num', FieldIndex('num'))
cat.addIndex('big', FieldIndex('big'))
cat.addIndex('number', FieldIndex('number'))
i = ZCTextIndex('title', caller=cat, index_factory=OkapiIndex,
lexicon_id='lexicon')
cat.addIndex('title', i)
cat = cat.__of__(ZDummy(16336))
text_index = ZCTextIndex('title', caller=cat,
index_factory=OkapiIndex,
lexicon_id='lexicon')
cat.addIndex('title', text_index)
cat = cat.__of__(ZDummy(16336 + ci))
for i in range(10):
obj = ZDummy(i)
obj.big = i > 5
Expand Down

0 comments on commit c342d31

Please sign in to comment.