def test_file_storage_load(): meta = StorageMeta() storage = BatchStorageFile(meta, directory="test") X = np.array([1, 2, 3]) y = np.array([0, 0, 0]) storage.save(X, y) X_data, y_data = storage.load(0) assert np.array_equal(X_data, X) assert np.array_equal(y_data, y)
def test_file_storage_metadata_val(): meta = StorageMeta(validation_split=1.0) storage = BatchStorageFile(meta, directory="test") X = np.array([1, 2, 3]) y = np.array([0, 0, 0]) storage.save(X, y) storage.save_meta({}) params = storage.load_meta() assert len(params["val_ids"]) == 1 assert params["val_map"][params["val_ids"][0]] == "IDv_0" assert len(params["train_ids"]) == 0
def test_file_storage_save(): meta = StorageMeta() storage = BatchStorageFile(meta, directory="test") X = np.array([1, 2, 3]) y = np.array([0, 0, 0]) filename = storage.save(X, y) assert os.path.isfile(filename)