def timeseriesdata_constructor_new_file(temp_dir):
"""Tests the TimeSeriesData class constructor when the file does not
exist. Tests that a new file is created, that all expected data sets
are present, and that the flag that indicates that the file is empty
is set to False.
"""
tsd = TimeSeriesData(temp_dir + "/new_ananke.h5")
tsd_file = Path(temp_dir + "/new_ananke.h5")
#Check that the file was really created
assert tsd_file.is_file()
#Check that the data sets have been created
assert set(tsd.h5_table.keys()) == {"genes", "timeseries", "samples"}
assert set(tsd.h5_table["timeseries"].keys()) == {"data", "indices",
"indptr"}
assert set(tsd.h5_table["genes"].keys()) == {"sequences", "sequenceids",
"clusters", "taxonomy",
"sequenceclusters"}
assert set(tsd.h5_table["samples"].keys()) == {"names", "time",
"metadata", "mask"}
#Check that the empty file flag is set
assert tsd.filled_data == False
评论列表
文章目录