def test_add_registries(): registries1 = new_registry_list() registries2 = new_registry_list() summed_registries = registries1 + registries2 assert len([r for r in summed_registries.registries]) == ( len([r for r in registries1.registries]) + len([r for r in registries2.registries]) )
def obj_registry_with_none_with_defaults(request): return { "registries": new_registry_list(get_fixture_val(request.param[0], request)), "dumpable_object": get_fixture_val(request.param[1], request) }
def test_require_group_exist(self, h5py_file_with_group): group = h5py_file_with_group["example"] h5preserve_group = H5PreserveGroup( h5py_file_with_group, new_registry_list() ) h5preserve_subgroup = h5preserve_group.require_group("example") assert h5preserve_subgroup.h5py_group == group
def test_h5py_external_link(self, h5py_file_with_group): external = ExternalLink("external.hdf5", "example") registries = new_registry_list() registries.to_file(h5py_file_with_group, "alias", external) assert h5py_file_with_group.get("alias", getlink=True).path == "example" assert h5py_file_with_group.get( "alias", getlink=True).filename == "external.hdf5"
def test_roundtrip(self, h5py_file): assert h5py_file == H5PreserveFile(h5py_file, new_registry_list()).h5py_file
def test_create_group(self, h5py_file_with_group): group = h5py_file_with_group["example"] h5preserve_group = H5PreserveGroup(group, new_registry_list()) h5preserve_subgroup = h5preserve_group.create_group("subexample") assert h5preserve_subgroup.h5py_group == group["subexample"]
def test_roundtrip(self, h5py_file_with_group): group = h5py_file_with_group["example"] assert group == H5PreserveGroup( group, new_registry_list() ).h5py_group
def test_h5py_external_link(self, h5py_file_with_group): external = ExternalLink("external.hdf5", "example") registries = new_registry_list() registries.to_file(h5py_file_with_group, "alias", external) assert h5py_file_with_group.get("alias", getlink=True).path == "example" assert h5py_file_with_group.get("alias", getlink=True).filename == "external.hdf5"
def test_h5py_soft_link(self, h5py_file_with_group): soft_link = SoftLink("example") registries = new_registry_list() registries.to_file(h5py_file_with_group, "alias", soft_link) assert h5py_file_with_group.get("alias", getlink=True).path == "example"
def obj_registry_with_none_with_defaults(request): return { "registries": new_registry_list(request.param[0]), "dumpable_object": request.param[1] }
def test_roundtrip(self, h5py_file): assert h5py_file == H5PreserveFile( h5py_file, new_registry_list() ).h5py_file
""" Defines common data structures and how they are to be written to files """ from h5preserve import new_registry_list from . import _dumpers # noqa from . import _loaders # noqa from ._containers import ( # noqa Solution, SolutionInput, ConfigInput, Run, InitialConditions, ) from ._old_dict_loading import (dict_as_group_registry as _dict_as_group_registry) from ._utils import ds_registry as _ds_registry, get_fields registries = new_registry_list(_ds_registry, _dict_as_group_registry) CONFIG_FIELDS = get_fields(ConfigInput)