Пример #1
0
 def test_delegates_to_an_instancemethod(self):
     value = mock.Mock()
     class Obj(object):
         def instancemethod(self):
             return value
     delegator = SimpleDelegator(Obj())
     expect(delegator.instancemethod()) == value
Пример #2
0
 def test_sets_attributes_on_the_delegated_object(self):
     obj = mock.Mock()
     delegator = SimpleDelegator(obj)
     delegator.some_attr = mock.Mock()
     expect(obj.some_attr) == delegator.some_attr