def test_exists(self, hdf_data_set, filepath_hdf, dummy_dataframe): """Test `exists` method invocation.""" # file does not exist assert not hdf_data_set.exists() # file and key exist hdf_data_set.save(dummy_dataframe) assert hdf_data_set.exists() # file exists but the key does not data_set2 = HDFLocalDataSet(filepath=filepath_hdf, key="test_hdf_different_key") assert not data_set2.exists()
def hdf_data_set_with_args(filepath_hdf): return HDFLocalDataSet( filepath=filepath_hdf, key="test_hdf", load_args={"errors": "ignore"}, save_args={"errors": "ignore"}, )
def test_version_str_repr(self, load_version, save_version): """Test that version is in string representation of the class instance when applicable.""" filepath = "test.hdf" ds = HDFLocalDataSet(filepath=filepath, key="test_hdf") ds_versioned = HDFLocalDataSet( filepath=filepath, key="test_hdf", version=Version(load_version, save_version), ) assert filepath in str(ds) assert "version" not in str(ds) assert filepath in str(ds_versioned) ver_str = "version=Version(load={}, save='{}')".format( load_version, save_version) assert ver_str in str(ds_versioned)
def versioned_hdf_data_set(filepath_hdf, load_version, save_version): return HDFLocalDataSet( filepath=filepath_hdf, key="test_hdf", version=Version(load_version, save_version), )
def hdf_data_set(filepath_hdf): return HDFLocalDataSet(filepath=filepath_hdf, key="test_hdf")