[Zope3-checkins] SVN: Zope3/branches/jim-index/src/zope/app/catalog/tests.py Added logic to tests to handle events for objects without ids.

Jim Fulton jim at zope.com
Wed Aug 18 15:23:40 EDT 2004


Log message for revision 27182:
  Added logic to tests to handle events for objects without ids.


Changed:
  U   Zope3/branches/jim-index/src/zope/app/catalog/tests.py


-=-
Modified: Zope3/branches/jim-index/src/zope/app/catalog/tests.py
===================================================================
--- Zope3/branches/jim-index/src/zope/app/catalog/tests.py	2004-08-18 19:23:06 UTC (rev 27181)
+++ Zope3/branches/jim-index/src/zope/app/catalog/tests.py	2004-08-18 19:23:39 UTC (rev 27182)
@@ -78,6 +78,9 @@
     def getId(self, ob):
         return self.ids[ob]
 
+    def queryId(self, ob, default=None):
+        return self.ids.get(ob, default)
+
     def items(self):
         return [(id, ReferenceStub(obj)) for id, obj in self.objs.items()]
 
@@ -120,14 +123,14 @@
         verifyObject(ICatalog, catalog)
         index = StubIndex('author', None)
         catalog['author'] = index
-        self.assertEqual(catalog.keys(), ['author'])
+        self.assertEqual(list(catalog.keys()), ['author'])
         index = StubIndex('title', None)
         catalog['title'] = index
-        indexes = catalog.keys()
+        indexes = list(catalog.keys())
         indexes.sort()
         self.assertEqual(indexes, ['author', 'title'])
         del catalog['author']
-        self.assertEqual(catalog.keys(), ['title'])
+        self.assertEqual(list(catalog.keys()), ['title'])
 
     def _frob_uniqueidutil(self, ints=True, apes=True):
         uidutil = UniqueIdUtilityStub()
@@ -163,7 +166,7 @@
         catalog = Catalog()
         catalog['author'] = StubIndex('author', None)
         catalog['title'] = StubIndex('author', None)
-        catalog.updateIndexe(catalog['author'])
+        catalog.updateIndex(catalog['author'])
         checkNotifies = catalog['author'].doc
         self.assertEqual(len(checkNotifies), 18)
         checkNotifies = catalog['title'].doc
@@ -258,6 +261,12 @@
         self.assertEqual(self.cat.regs, [(1, ob)])
         self.assertEqual(self.cat.unregs, [])
 
+        ob2 = Stub()
+        reindexDocSubscriber(ObjectModifiedEvent(ob2))
+        self.assertEqual(self.cat.regs, [(1, ob)])
+        self.assertEqual(self.cat.unregs, [])
+        
+
     def test_unindexDocSubscriber(self):
         from zope.app.catalog.catalog import unindexDocSubscriber
         from zope.app.container.contained import ObjectRemovedEvent



More information about the Zope3-Checkins mailing list