Skip to content

Commit 0d76ad8

Browse files
Add tests for build_model with parent field
1 parent ba1543b commit 0d76ad8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/build_spec/test_build_spec.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def _test_build_spec(
1818
use_original_covers=False,
1919
use_absoloute_arch_path=False,
2020
training_data=None,
21+
parent=None,
2122
):
2223
from bioimageio.core.build_spec import build_model
2324

@@ -118,6 +119,8 @@ def _test_build_spec(
118119
kwargs["covers"] = resolve_source(model_spec.covers, root)
119120
if training_data is not None:
120121
kwargs["training_data"] = training_data
122+
if parent is not None:
123+
kwargs["parent"] = parent
121124

122125
build_model(**kwargs)
123126
assert out_path.exists()
@@ -211,6 +214,16 @@ def test_build_spec_training_data2(unet2d_nuclei_broad_model, tmp_path):
211214
_test_build_spec(unet2d_nuclei_broad_model, tmp_path / "model.zip", "torchscript", training_data=training_data)
212215

213216

217+
def test_build_spec_parent1(unet2d_nuclei_broad_model, tmp_path):
218+
parent = {"uri": "https:/my-parent-model.org"}
219+
_test_build_spec(unet2d_nuclei_broad_model, tmp_path / "model.zip", "torchscript", parent=parent)
220+
221+
222+
def test_build_spec_parent2(unet2d_nuclei_broad_model, tmp_path):
223+
parent = {"id": "10.5281/zenodo.5764892"}
224+
_test_build_spec(unet2d_nuclei_broad_model, tmp_path / "model.zip", "torchscript", parent=parent)
225+
226+
214227
def test_build_spec_deepimagej_keras(unet2d_keras, tmp_path):
215228
_test_build_spec(
216229
unet2d_keras, tmp_path / "model.zip", "keras_hdf5", add_deepimagej_config=True, tensorflow_version="1.12"

0 commit comments

Comments
 (0)