test_database.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:ananke 作者: beiko-lab 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号