Log message for revision 115509:
  More trivial tests
  

Changed:
  U   Zope/trunk/src/Products/ZCatalog/plan.py
  U   Zope/trunk/src/Products/ZCatalog/tests/test_plan.py

-=-
Modified: Zope/trunk/src/Products/ZCatalog/plan.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/plan.py    2010-08-05 19:09:20 UTC (rev 
115508)
+++ Zope/trunk/src/Products/ZCatalog/plan.py    2010-08-05 19:16:37 UTC (rev 
115509)
@@ -138,6 +138,7 @@
 
     @classmethod
     def set(cls, value):
+        value = frozenset(value)
         with cls.lock:
             cls.value = value
 
@@ -172,7 +173,7 @@
                     # greater than zero
                     value_indexes.add(name)
 
-        cls.set(frozenset(value_indexes))
+        cls.set(value_indexes)
         return value_indexes
 
 

Modified: Zope/trunk/src/Products/ZCatalog/tests/test_plan.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/tests/test_plan.py 2010-08-05 19:09:20 UTC 
(rev 115508)
+++ Zope/trunk/src/Products/ZCatalog/tests/test_plan.py 2010-08-05 19:16:37 UTC 
(rev 115509)
@@ -155,8 +155,39 @@
         self.assertEquals(type(self.reports.lock), LockType)
 
 
-# class TestValueIndexes(unittest.TestCase):
+class TestValueIndexes(unittest.TestCase):
 
+    def setUp(self):
+        self.value = self._makeOne()
+
+    def tearDown(self):
+        self.value.clear()
+
+    def _makeOne(self):
+        from ..plan import ValueIndexes
+        return ValueIndexes
+
+    def test_get(self):
+        self.assertEquals(self.value.get(), frozenset())
+
+    def test_set(self):
+        indexes = ('index1', 'index2')
+        self.value.set(indexes)
+        self.assertEquals(self.value.get(), frozenset(indexes))
+
+    def test_clear(self):
+        self.value.set(('index1', ))
+        self.value.clear()
+        self.assertEquals(self.value.get(), frozenset())
+
+    def test_determine_already_set(self):
+        self.value.set(('index1', ))
+        self.assertEquals(self.value.determine(()), frozenset(('index1', )))
+
+
+# class TestValueIndexesDetermination(unittest.TestCase):
+# Test the actual logic for determining value indexes
+
 # class TestMakeKey(unittest.TestCase):
 
 class TestCatalogPlan(cleanup.CleanUp, unittest.TestCase):

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
https://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to