utils_suite.py 文件源码

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

项目:solidfire-cli 作者: solidfire 项目源码 文件源码
def check_tree_generator():
    # First, read in the appropriate values:
    # Input:
    resources = os.path.join("resources", "FormatterUnitTests")
    with open(os.path.join(resources, "JsonOutput.txt")) as f:
        objectModel=jsonpickle.decode(f.read())

    # Verify that they have all the same lines.
    with open(os.path.join(resources, "TreeDepth3.txt")) as f:
        treeDepth3 = f.read()
    assert collections.Counter(
        utils.get_result_as_tree(objectModel, depth=3).split("\n")
    ) == collections.Counter(
        treeDepth3.split("\n")
    )

    # Verify that if we change the depth, it still has all the same lines.
    with open(os.path.join(resources, "TreeDepth5.txt")) as f:
        treeDepth5 = f.read()
    assert collections.Counter(
        utils.get_result_as_tree(objectModel, depth=5).split("\n")
    ) == collections.Counter(
        treeDepth5.split("\n")
    )
    print("Tree generator is working.")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号