Log message for revision 124355:
  Add tests for misses in 'get'.

Changed:
  U   Zope/trunk/src/OFS/tests/testObjectManager.py

-=-
Modified: Zope/trunk/src/OFS/tests/testObjectManager.py
===================================================================
--- Zope/trunk/src/OFS/tests/testObjectManager.py       2012-02-09 17:11:52 UTC 
(rev 124354)
+++ Zope/trunk/src/OFS/tests/testObjectManager.py       2012-02-09 17:11:57 UTC 
(rev 124355)
@@ -412,19 +412,22 @@
         om = self._makeOne()
         self.assertTrue(om)
 
-    def test_get(self):
+    def test_get_miss_wo_default(self):
         om = self._makeOne()
+        self.assertEqual(om.get('nonesuch'), None)
+
+    def test_get_miss_w_default(self):
+        om = self._makeOne()
+        obj = object()
+        self.assertTrue(om.get('nonesuch', obj) is obj)
+
+    def test_get_hit(self):
+        om = self._makeOne()
         si1 = SimpleItem('1')
         om['1'] = si1
-        self.assertTrue(om.get('1') == si1)
-        # A contained item overwrites the method
-        self.assertTrue(hasattr(om.get, 'im_func'))
-        om.__dict__['get'] = si1
-        self.assertTrue(aq_base(om.get) is si1)
-        self.assertTrue(aq_base(om['get']) is si1)
-        # Once the object is gone, the method is back
-        del om['get']
-        self.assertTrue(hasattr(om.get, 'im_func'))
+        got = om.get('1')
+        self.assertTrue(got.aq_self is si1)
+        self.assertTrue(got.aq_parent is om)
 
     def test_items(self):
         om = self._makeOne()

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

Reply via email to