def _load_data(self): random.seed(0) reader = PickleReader(self._file_name) table = reader.read() self.n_rows, self.n_cols = table.X.shape attrs = self.__attributes(table.domain.attributes) metas = table.domain.metas + table.domain.class_vars domain = Domain(attrs, metas=metas) return table.transform(domain)[self.__row_indices()]
def test_open_bad_pickle(self): """ Raise TypeError when PickleReader reads a pickle file without a table (and it suppose to be there). GH-2232 """ reader = PickleReader("") with unittest.mock.patch("pickle.load", return_value=None): self.assertRaises(TypeError, reader.read, "foo")