[Zope-Checkins] SVN: Zope/branches/2.12/src/OFS/tests/testObjectManager.py Add tests for misses in 'get'.
Tres Seaver
tseaver at palladion.com
Thu Feb 9 17:11:36 UTC 2012
Log message for revision 124353:
Add tests for misses in 'get'.
Changed:
U Zope/branches/2.12/src/OFS/tests/testObjectManager.py
-=-
Modified: Zope/branches/2.12/src/OFS/tests/testObjectManager.py
===================================================================
--- Zope/branches/2.12/src/OFS/tests/testObjectManager.py 2012-02-09 17:04:54 UTC (rev 124352)
+++ Zope/branches/2.12/src/OFS/tests/testObjectManager.py 2012-02-09 17:11:36 UTC (rev 124353)
@@ -387,11 +387,22 @@
om = self._makeOne()
self.failUnless(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.failUnless(om.get('nonesuch', obj) is obj)
+
+ def test_get_hit(self):
+ om = self._makeOne()
si1 = SimpleItem('1')
om['1'] = si1
- self.failUnless(om.get('1') == si1)
+ got = om.get('1')
+ self.failUnless(got.aq_self is si1)
+ self.failUnless(got.aq_parent is om)
def test_items(self):
om = self._makeOne()
More information about the Zope-Checkins
mailing list