def setUp(self): super(PickleTests, self).setUp() self._pickler = pickle.Pickler() self._unpickler = pickle.Unpickler() self._dumps = self._pickler.dumps self._loads = self._unpickler.loads
def loads(self, buf): f = io.BytesIO(buf) u = pickle.Unpickler(f) return u.load()
def test_read_exception(self): f = ExceptionFileLike() u = pickle.Unpickler(f) self.assertRaises(RuntimeError, u.load)