2
2
3
3
import os
4
4
import unittest
5
- import h5py
6
- import zarr
7
- from ruamel .yaml import YAML
8
5
from pathlib import Path
9
6
7
+ import h5py
10
8
import numpy as np
9
+ import zarr
11
10
from linkml_runtime import SchemaView
11
+ from ruamel .yaml import YAML
12
12
13
13
from linkml_arrays .dumpers import (
14
14
Hdf5Dumper ,
@@ -105,12 +105,12 @@ def test_yaml_hdf5_dumper():
105
105
assert actual == expected
106
106
107
107
108
- def test_hdf5_dumper ():
108
+ def test_hdf5_dumper (tmp_path ):
109
109
"""Test Hdf5Dumper dumping to an HDF5 file."""
110
110
container = create_container ()
111
111
112
112
schemaview = SchemaView (INPUT_DIR / "temperature_schema.yaml" )
113
- output_file_path = "my_container.h5"
113
+ output_file_path = tmp_path / "my_container.h5"
114
114
Hdf5Dumper ().dumps (container , schemaview = schemaview , output_file_path = output_file_path )
115
115
116
116
assert os .path .exists (output_file_path )
@@ -135,20 +135,19 @@ def test_hdf5_dumper():
135
135
)
136
136
137
137
138
- def test_zarr_directory_store_dumper ():
138
+ def test_zarr_directory_store_dumper (tmp_path ):
139
139
"""Test ZarrDumper dumping to an HDF5 file."""
140
140
container = create_container ()
141
141
142
142
schemaview = SchemaView (INPUT_DIR / "temperature_schema.yaml" )
143
- output_file_path = "my_container.zarr"
143
+ output_file_path = tmp_path / "my_container.zarr"
144
144
ZarrDirectoryStoreDumper ().dumps (
145
145
container , schemaview = schemaview , output_file_path = output_file_path
146
146
)
147
147
148
- file_path = "my_container.zarr"
149
- assert os .path .exists (file_path )
148
+ assert os .path .exists (output_file_path )
150
149
151
- root = zarr .group (store = file_path )
150
+ root = zarr .group (store = output_file_path )
152
151
# NOTE this is pretty much the same code as test_hdf5_dumper
153
152
assert root .attrs ["name" ] == "my_container"
154
153
assert set (root ["latitude_series" ].keys ()) == set (["values" ])
0 commit comments