[Zope-Checkins] CVS: Zope/lib/python/Products/PluginIndexes/PathIndex/tests - testPathIndex.py:1.7.4.2

Chris McDonough chrism@zope.com
Fri, 3 Jan 2003 01:34:03 -0500


Update of /cvs-repository/Zope/lib/python/Products/PluginIndexes/PathIndex/tests
In directory cvs.zope.org:/tmp/cvs-serv27194/PluginIndexes/PathIndex/tests

Modified Files:
      Tag: chrism-install-branch
	testPathIndex.py 
Log Message:
Merging chrism-install-branch with HEAD (hopefully for one of the last
times).



=== Zope/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py 1.7.4.1 => 1.7.4.2 ===
--- Zope/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py:1.7.4.1	Tue Oct  8 14:41:11 2002
+++ Zope/lib/python/Products/PluginIndexes/PathIndex/tests/testPathIndex.py	Fri Jan  3 01:33:00 2003
@@ -78,6 +78,61 @@
         assert len(self._index._index)==0
         assert len(self._index._unindex)==0
 
+    def testUnIndexError(self):
+        self._populateIndex()
+        
+        # this should not raise an error
+        self._index.unindex_object(-1)
+
+        # nor should this
+        self._index._unindex[1] = "/broken/thing"
+        self._index.unindex_object(1)
+
+    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 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 testRoot(self):