[Zope3-checkins] SVN: Zope3/branches/jim-index/src/zope/app/catalog/tests.py Removed unused imports from catalog tests and made some cosmetic changes.

Gintautas Miliauskas gintas at pov.lt
Sat Jun 12 10:53:30 EDT 2004


Log message for revision 25401:
Removed unused imports from catalog tests and made some cosmetic changes.



-=-
Modified: Zope3/branches/jim-index/src/zope/app/catalog/tests.py
===================================================================
--- Zope3/branches/jim-index/src/zope/app/catalog/tests.py	2004-06-12 14:27:55 UTC (rev 25400)
+++ Zope3/branches/jim-index/src/zope/app/catalog/tests.py	2004-06-12 14:53:29 UTC (rev 25401)
@@ -23,8 +23,6 @@
 
 from zope.interface import implements
 from zope.interface.verify import verifyObject
-from zope.app.site.interfaces import ISite
-from zope.app import zapi
 from zope.app.tests import ztapi
 from zope.app.tests.placelesssetup import PlacelessSetup
 from BTrees.IIBTree import IISet
@@ -33,7 +31,6 @@
 from zope.index.interfaces import IInjection, ISimpleQuery
 from zope.app.catalog.interfaces import ICatalog
 from zope.app.catalog.catalog import Catalog
-from zope.app.index.interfaces.field import IUIFieldCatalogIndex
 
 
 class ReferenceStub:
@@ -43,6 +40,7 @@
     def __call__(self):
         return self.obj
 
+
 class UniqueIdUtilityStub:
     """A stub for UniqueIdUtility."""
     implements(IUniqueIdUtility)
@@ -80,6 +78,8 @@
 
 
 class StubIndex:
+    """A stub for Index."""
+
     implements(ISimpleQuery, IInjection)
 
     def __init__(self, field_name, interface=None):
@@ -142,7 +142,7 @@
             uidutil.register(stoopid(simiantype='punyhuman', name='kev'))
 
     def test_updateindexes(self):
-        "test a full refresh"
+        """Test a full refresh."""
         self._frob_uniqueidutil()
         catalog = Catalog()
         catalog['author'] = StubIndex('author', None)
@@ -151,46 +151,52 @@
         for index in catalog.values():
             checkNotifies = index.doc
             self.assertEqual(len(checkNotifies), 18)
-###            notifLocs = [ x.location for x in checkNotifies ]
-###            notifLocs.sort()
-###            expected = [ "/%s"%(i+1) for i in range(18) ]
-###            expected.sort()
-###            self.assertEqual(notifLocs, expected)
+            ### notifLocs = [ x.location for x in checkNotifies ]
+            ### notifLocs.sort()
+            ### expected = [ "/%s"%(i+1) for i in range(18) ]
+            ### expected.sort()
+            ### self.assertEqual(notifLocs, expected)
 
     def test_basicsearch(self):
-        "test the simple searchresults interface"
+        """Test the simple search results interface."""
         self._frob_uniqueidutil(ints=0)
         catalog = Catalog()
         catalog['simiantype'] = StubIndex('simiantype', None)
         catalog['name'] = StubIndex('name', None)
         catalog.updateIndexes()
+
         res = catalog.searchResults(simiantype='monkey')
         names = [x.name for x in res]
         names.sort()
         self.assertEqual(len(names), 3)
         self.assertEqual(names, ['bobo', 'bubbles', 'ginger'])
+
         res = catalog.searchResults(name='bobo')
         names = [x.simiantype for x in res]
         names.sort()
         self.assertEqual(len(names), 2)
         self.assertEqual(names, ['bonobo', 'monkey'])
+
         res = catalog.searchResults(simiantype='punyhuman', name='anthony')
         self.assertEqual(len(res), 1)
         ob = iter(res).next()
-        self.assertEqual((ob.name,ob.simiantype), ('anthony', 'punyhuman'))
+        self.assertEqual((ob.name, ob.simiantype), ('anthony', 'punyhuman'))
+
         res = catalog.searchResults(simiantype='ape', name='bobo')
         self.assertEqual(len(res), 0)
+
         res = catalog.searchResults(simiantype='ape', name='mwumi')
         self.assertEqual(len(res), 0)
         self.assertRaises(ValueError, catalog.searchResults,
                           simiantype='monkey', hat='beret')
-        res = list(res)
 
+
 def test_suite():
     suite = unittest.TestSuite()
     suite.addTest(unittest.makeSuite(Test))
     return suite
 
+
 if __name__ == "__main__":
     unittest.main()
 




More information about the Zope3-Checkins mailing list