Commit b087d5f4 authored by Andreas Jung's avatar Andreas Jung

- removed empty or meaningless comments

- minor source code cleanup
parent 3bdab66c
......@@ -32,13 +32,9 @@ class Dummy:
__repr__ = __str__
class TestCase( unittest.TestCase ):
"""
Test PathIndex objects.
"""
""" Test PathIndex objects """
def setUp( self ):
"""
"""
def setUp(self):
self._index = PathIndex( 'path' )
self._values = {
1 : Dummy("/aa/aa/aa/1.html"),
......@@ -61,27 +57,18 @@ class TestCase( unittest.TestCase ):
18 : Dummy("/bb/cc/cc/18html")
}
def tearDown( self ):
"""
"""
def _populateIndex( self ):
def _populateIndex(self):
for k, v in self._values.items():
self._index.index_object( k, v )
def testEmpty( self ):
"Test an empty PathIndex."
def testEmpty(self):
assert len( self._index ) == 0
assert self._index.getEntryForObject( 1234 ) is None
self._index.unindex_object( 1234 ) # nothrow
assert self._index._apply_index( {"suxpath":"xxx"} ) is None
def testUnIndex( self ):
"Test to UnIndex PathIndex."
def testUnIndex(self):
self._populateIndex()
......@@ -92,7 +79,7 @@ class TestCase( unittest.TestCase ):
assert len(self._index._unindex)==0
def testSimpleTests( self ):
def testSimpleTests(self):
self._populateIndex()
......@@ -123,8 +110,7 @@ class TestCase( unittest.TestCase ):
lst = list(res[0].keys())
self.assertEqual(lst,results)
def testComplexOrTests( self ):
def testComplexOrTests(self):
self._populateIndex()
......@@ -141,7 +127,7 @@ class TestCase( unittest.TestCase ):
lst = list(res[0].keys())
self.assertEqual(lst,results)
def testComplexANDTests( self ):
def testComplexANDTests(self):
self._populateIndex()
......@@ -158,6 +144,5 @@ class TestCase( unittest.TestCase ):
lst = list(res[0].keys())
self.assertEqual(lst,results)
def test_suite():
return unittest.makeSuite( TestCase )
......@@ -67,7 +67,6 @@ class TestTopicIndex(TestBase):
def testOr(self):
""" test 1 """
self._searchOr('doc1',[1,2])
self._searchOr(['doc1'],[1,2])
......@@ -77,7 +76,6 @@ class TestTopicIndex(TestBase):
def testAnd(self):
""" test 1 """
self._searchAnd('doc1',[1,2])
self._searchAnd(['doc1'],[1,2])
......@@ -107,21 +105,18 @@ class ZCatalogTopicTests(TestBase):
self.cat.catalog_object(Obj('5','doc3'))
self.cat.catalog_object(Obj('6','doc3'))
def testOr(self):
""" testing or (catalog)"""
self._searchOr('doc1',[1,2])
self._searchOr('doc2',[3,4])
self._searchOr(['doc1','doc2'],[1,2,3,4])
def testAnd(self):
""" testing And (catalog)"""
self._searchAnd('doc1',[1,2])
self._searchAnd('doc2',[3,4])
self._searchAnd(['doc1','doc2'],[])
def _search(self,query,operator,expected):
res = self.cat.searchResults({'topic':{'query':query,'operator':operator}})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment