Commit 3bad42ba authored by Tres Seaver's avatar Tres Seaver

Add tests for misses in 'get'.

parent 769bb443
...@@ -387,11 +387,22 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase): ...@@ -387,11 +387,22 @@ class ObjectManagerTests(PlacelessSetup, unittest.TestCase):
om = self._makeOne() om = self._makeOne()
self.failUnless(om) 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() om = self._makeOne()
si1 = SimpleItem('1') si1 = SimpleItem('1')
om['1'] = si1 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): def test_items(self):
om = self._makeOne() om = self._makeOne()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment