Skip to content

Commit 4120317

Browse files
committed
test(transform-io): wasi format tests
1 parent bdbbc2f commit 4120317

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

packages/transform-io/python/itkwasm-transform-io-wasi/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ classifiers = [
2424
"Programming Language :: Python :: 3.10",
2525
"Programming Language :: Python :: 3.11",
2626
"Programming Language :: Python :: 3.12",
27+
"Programming Language :: Python :: 3.13",
2728
]
2829
keywords = [
2930
"itkwasm",
@@ -33,7 +34,7 @@ keywords = [
3334

3435
requires-python = ">=3.8"
3536
dependencies = [
36-
"itkwasm >= 1.0.b171",
37+
"itkwasm >= 1.0.b181",
3738
"importlib_resources",
3839

3940
]
Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
from pathlib import Path
2+
import numpy as np
3+
4+
from itkwasm import TransformList, TransformParameterizations, FloatTypes
25

36
test_input_path = Path(__file__).parent / ".." / ".." / ".." / "test" / "data" / "input"
47
test_baseline_path = Path(__file__).parent / ".." / ".." / ".." / "test" / "data" / "baseline"
58
test_output_path = Path(__file__).parent / ".." / ".." / ".." / "test" / "data" / "output" / "python"
6-
test_output_path.mkdir(parents=True, exist_ok=True)
9+
test_output_path.mkdir(parents=True, exist_ok=True)
10+
11+
def verify_test_linear_transform(transform_list: TransformList):
12+
assert len(transform_list.transforms) == 1
13+
transform = transform_list.transforms[0]
14+
assert transform.name == "Transform"
15+
assert transform.transformType.transformParameterization == TransformParameterizations.Affine
16+
assert transform.transformType.parametersValueType == FloatTypes.Float64
17+
assert transform.transformType.fixedParametersValueType == FloatTypes.Float64
18+
assert transform.numberOfParameters == 12
19+
assert transform.numberOfFixedParameters == 3
20+
assert np.testing.array_almost_equals(transform.fixedParameters, [0.0, 0.0, 0.0])
21+
assert np.testing.array_almost_equals(transform.parameters, [1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0])
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
# Generated file. To retain edits, remove this comment.
1+
from pathlib import Path
22

33
from itkwasm_transform_io_wasi import hdf5_read_transform
44

5-
from .common import test_input_path, test_output_path
5+
from .common import test_input_path, test_output_path, verify_test_linear_transform
6+
7+
test_input_file_path = test_input_path / "LinearTransform.h5"
8+
test_output_file_path = test_output_path / "hdf5-test-write-LinearTransform.h5"
69

710
def test_hdf5_read_transform():
8-
pass
11+
could_read, transform_list = hdf5_read_transform(test_input_file_path)
12+
assert could_read
13+
verify_test_linear_transform(transform_list)

0 commit comments

Comments
 (0)