def test_reduce(self): pickle.dumps(self.wrapped_object) with self.assertRaises(pickle.PicklingError): UNPICKLEABLE = type('UNPICKLEABLE', (ObjectProxy, ), {}) pickle.dumps(MemorizedObject(UNPICKLEABLE(self.wrapped_object)))
def setUp(self): self.wrapped_object = [1, 2, 3] self.instance = MemorizedObject(self.wrapped_object)