示例#1
0
def test_roundtrip(tmpdir, obj_registry):
    tmpfile = str(tmpdir.join("test_roundtrip.h5"))
    with hp_open(tmpfile, registries=obj_registry["registries"]) as f:
        f["first"] = obj_registry["dumpable_object"]

    with hp_open(tmpfile, registries=obj_registry["registries"]) as f:
        roundtripped = f["first"]
        assert roundtripped == obj_registry["dumpable_object"]
示例#2
0
def test_roundtrip(tmpdir, obj_registry):
    tmpfile = str(tmpdir.join("test_roundtrip.h5"))
    with hp_open(tmpfile, registries=obj_registry["registries"]) as f:
        f["first"] = obj_registry["dumpable_object"]

    with hp_open(tmpfile, registries=obj_registry["registries"]) as f:
        roundtripped = f["first"]
        assert roundtripped == obj_registry["dumpable_object"]
示例#3
0
    def test_roundtrip_with_defaults_with_none(tmpdir, obj_registry_with_none_with_defaults):
        obj_registry_with_none = obj_registry_with_none_with_defaults
        tmpfile = str(tmpdir.join("test_roundtrip.h5"))
        with hp_open(tmpfile, registries=obj_registry_with_none["registries"]) as f:
            f["first"] = obj_registry_with_none["dumpable_object"]

        with hp_open(tmpfile, registries=obj_registry_with_none["registries"]) as f:
            roundtripped = f["first"]
            assert roundtripped == obj_registry_with_none["dumpable_object"]
示例#4
0
def test_roundtrip_with_defaults(tmpdir, obj_registry_with_defaults):
    obj_registry = obj_registry_with_defaults
    tmpfile = str(tmpdir.join("test_roundtrip.h5"))
    with hp_open(tmpfile, registries=obj_registry["registries"],
                 mode='x') as f:
        f["first"] = obj_registry["dumpable_object"]

    with hp_open(tmpfile, registries=obj_registry["registries"],
                 mode='r') as f:
        roundtripped = f["first"]
        assert roundtripped == obj_registry["dumpable_object"]