[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py Brought forward from the Zope 2.7 branch:

Zachery Bir zbir at urbanape.com
Wed Aug 24 11:51:38 EDT 2005


Log message for revision 38061:
  Brought forward from the Zope 2.7 branch:
  
    - deleted trailing whitespace
  
    - new test for removal (indexing an object with a value of None
      should remove it from the index)
  

Changed:
  U   Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py

-=-
Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py	2005-08-24 15:51:01 UTC (rev 38060)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py	2005-08-24 15:51:38 UTC (rev 38061)
@@ -239,7 +239,21 @@
             val = (((yr * 12 + mo) * 31 + dy) * 24 + hr) * 60 + mn
             self.failUnlessEqual(self._index.getEntryForObject(k), val)
 
+    def test_removal(self):
+        """ DateIndex would hand back spurious entries when used as a
+            sort_index, because it previously was not removing entries
+            from the _unindex when indexing an object with a value of
+            None. The catalog consults a sort_index's
+            documentToKeyMap() to build the brains.
+        """
+        values = self._values
+        index = self._index
+        self._populateIndex()
+        self._checkApply(self._int_req, [values[7]])
+        index.index_object(7, None)
+        self.failIf(7 in index.documentToKeyMap().keys())
 
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest( unittest.makeSuite( DI_Tests ) )



More information about the Zope-Checkins mailing list