예제 #1
0
    def test_save_tree_nonroot(self):
        a = ytree.load(CT)

        t = list(a[0]["tree"])[1]
        fn = t.save_tree()
        a2 = ytree.load(fn)

        fields = a2.field_list[:]
        fields.remove("desc_uid")
        compare_trees(t, a2[0], fields=fields)
예제 #2
0
    def test_save_tree(self):
        a = ytree.load(CT)

        t = a[0]
        fn = t.save_tree()
        a2 = ytree.load(fn)

        fields = a2.field_list[:]
        fields.remove("desc_uid")
        compare_trees(t, a2[0], fields=fields)
예제 #3
0
파일: test_saving.py 프로젝트: stalei/ytree
    def test_save_tree(self):
        a = ytree.load(CT)

        for t in [a[0], a[0]["tree"][1]]:
            fn = t.save_tree()
            a2 = ytree.load(fn)

            fields = a2.field_list[:]
            fields.remove("desc_uid")
            compare_trees(t, a2[0], fields=fields)
예제 #4
0
    def test_save_non_roots(self):
        a = ytree.load(CT)

        my_trees = [list(a[0]["tree"])[1], list(a[1]["tree"])[1]]
        fn = a.save_arbor(trees=my_trees)
        a2 = ytree.load(fn)

        fields = a2.field_list[:]
        fields.remove("desc_uid")

        for t1, t2 in zip(a2, my_trees):
            compare_trees(t1, t2, fields=fields)
예제 #5
0
    def test_save_field_list(self):
        a = ytree.load(CT)

        my_trees = [list(a[0]["tree"])[1], list(a[1]["tree"])[1]]
        fn = a.save_arbor(trees=my_trees, fields=["mass", "redshift"])
        a2 = ytree.load(fn)

        assert len(a2.field_list) == 4
        assert sorted(["mass", "redshift", "uid", "desc_uid"]) == \
          sorted(a2.field_list)

        fields = a2.field_list[:]
        fields.remove("desc_uid")

        for t1, t2 in zip(a2, my_trees):
            compare_trees(t1, t2, fields=fields)