[Zope-Checkins] CVS: Zope2 - testPathIndex.py:1.1.2.10

andreas@serenade.digicool.com andreas@serenade.digicool.com
Mon, 21 May 2001 12:27:07 -0400


Update of /cvs-repository/Zope2/lib/python/Products/PluginIndexes/tests
In directory serenade:/tmp/cvs-serv13697/lib/python/Products/PluginIndexes/tests

Modified Files:
      Tag: ajung-dropin-registry
	testPathIndex.py 
Log Message:
more tests



--- Updated File testPathIndex.py in package Zope2 --
--- testPathIndex.py	2001/05/21 13:09:45	1.1.2.9
+++ testPathIndex.py	2001/05/21 16:27:07	1.1.2.10
@@ -174,48 +174,25 @@
     def testPopulateIndex( self ):
 
         self._populateIndex()
-
-        res= self._index._apply_index( {"path":"aa","path_level":0})
-        lst = list(res[0].keys())
-        assert lst==[1,2,3,4,5,6,7,8,9],res
-
-        res= self._index._apply_index( {"path":"aa","path_level":1})
-        lst = list(res[0].keys())
-        assert lst==[1,2,3,10,11,12],res
-
-        res= self._index._apply_index( {"path":"bb","path_level":0})
-        lst = list(res[0].keys())
-        assert lst==[10,11,12,13,14,15,16,17,18],res
-
-        res= self._index._apply_index( {"path":"bb","path_level":1})
-        lst = list(res[0].keys())
-        assert lst==[4,5,6,13,14,15],res
-
-        res= self._index._apply_index( {"path":"/bb/cc","path_level":0})
-        lst = list(res[0].keys())
-        assert lst==[16,17,18],res
-
-        res= self._index._apply_index( {"path":"/bb/cc","path_level":1})
-        lst = list(res[0].keys())
-        assert lst==[6,15],res
-
-        res= self._index._apply_index( {"path":"/bb/aa","path_level":0})
-        lst = list(res[0].keys())
-        assert lst==[10,11,12],res
-
-        res= self._index._apply_index( {"path":"/bb/aa","path_level":1})
-        lst = list(res[0].keys())
-        assert lst==[4,13],res
-
-        res= self._index._apply_index( {"path":"/aa/cc","path_level":-1})
-        lst = list(res[0].keys())
-        assert lst==[3,7,8,9,12],res
-
-
-        res= self._index._apply_index( {"path":"/bb/bb","path_level":-1})
-        lst = list(res[0].keys())
-        assert lst==[5,13,14,15],res
-
+        
+        tests = [
+            ("aa",0, [1,2,3,4,5,6,7,8,9]),
+            ("aa",1, [1,2,3,10,11,12] ),
+            ("bb",0, [10,11,12,13,14,15,16,17,18]),
+            ("bb",1, [4,5,6,13,14,15] ),
+            ("bb/cc",0, [16,17,18] ),
+            ("bb/cc",1, [6,15] ),
+            ("bb/aa",0, [10,11,12] ),
+            ("bb/aa",1, [4,13] ),
+            ("aa/cc",-1, [3,7,8,9,12] ),
+            ("bb/bb",-1, [5,13,14,15] )
+        ]
+
+        for comp,level,results in tests:
+            for path in [comp,"/"+comp,"/"+comp+"/"]:
+                res = self._index._apply_index({"path":path,"path_level":level})
+                lst = list(res[0].keys())
+                assert lst==results,res
 
         
 def test_suite():