示例#1
0
 def test_can_be_pickled(self):
     obj = [1, 2, 3]
     delegator = SimpleDelegator(obj)
     pickled = pickle.dumps(delegator)
     del delegator
     unpickled_delegator = pickle.loads(pickled)
     expect(get_delegated(unpickled_delegator)) == obj
示例#2
0
    def test_sets_object_inside_delegator(self):
        delegator = SimpleDelegator(mock.Mock())
        another_obj = mock.Mock()
        set_delegated(delegator, another_obj)

        expect(get_delegated(delegator)) == another_obj
示例#3
0
    def test_returns_object_inside_delegator(self):
        obj = mock.Mock()
        delegator = SimpleDelegator(obj)

        expect(get_delegated(delegator)) == obj