[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/PathIndex/tests - testPathIndex.py:1.5.16.1
Andreas Jung
andreas@digicool.com
Thu, 3 Oct 2002 09:34:44 -0400
Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/PathIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv20337/tests
Modified Files:
Tag: Zope-2_5-branch
testPathIndex.py
Log Message:
added test for searching for the root object
=== Zope/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py 1.5 => 1.5.16.1 ===
--- Zope/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py:1.5 Wed Nov 28 10:51:03 2001
+++ Zope/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py Thu Oct 3 09:34:44 2002
@@ -90,8 +90,29 @@
assert len(self._index._index)==0
assert len(self._index._unindex)==0
-
+ def testRoot(self):
+
+ self._populateIndex()
+
+ tests = [
+ ("/",0, range(1,19)),
+ ]
+
+ for comp,level,results in tests:
+ for path in [comp,"/"+comp,"/"+comp+"/"]:
+ res = self._index._apply_index(
+ {"path":{'query':path,"level":level}})
+ lst = list(res[0].keys())
+ self.assertEqual(lst,results)
+
+ for comp,level,results in tests:
+ for path in [comp,"/"+comp,"/"+comp+"/"]:
+ res = self._index._apply_index(
+ {"path":{'query':( (path,level),)}})
+ lst = list(res[0].keys())
+ self.assertEqual(lst,results)
+
def testSimpleTests( self ):
self._populateIndex()
@@ -161,3 +182,13 @@
def test_suite():
return unittest.makeSuite( TestCase )
+
+
+def test_suite():
+ return unittest.makeSuite( TestCase )
+
+def main():
+ unittest.TextTestRunner().run(test_suite())
+
+if __name__ == '__main__':
+ main()