Skip to content

Commit 37f51dc

Browse files
authored
[ds-api] Modification of dataset with float-type layer results in JSON dump error (#358)
* Create failing test * Fix JSON serialization error for numpy float * applied changes: all properties_floating_type_to_python_type values are strings
1 parent eb34831 commit 37f51dc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_dataset.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,21 @@ def test_open_dataset() -> None:
196196

197197
assert len(ds.properties.data_layers) == 1
198198
assert len(ds.properties.data_layers["color"].wkw_magnifications) == 1
199+
200+
201+
def test_modify_existing_dataset() -> None:
202+
delete_dir(TESTOUTPUT_DIR / "simple_wk_dataset")
203+
ds1 = Dataset.create(TESTOUTPUT_DIR / "simple_wk_dataset", scale=(1, 1, 1))
204+
ds1.add_layer(
205+
"color", LayerCategories.COLOR_TYPE, dtype_per_layer="float", num_channels=1
206+
)
207+
208+
ds2 = Dataset(TESTOUTPUT_DIR / "simple_wk_dataset")
209+
ds2.add_layer(
210+
'segmentation', LayerCategories.SEGMENTATION_TYPE, 'uint8', largest_segment_id=100000
211+
)
212+
213+
assert((TESTOUTPUT_DIR / "simple_wk_dataset" / "segmentation").is_dir())
199214

200215

201216
def test_view_read_with_open() -> None:

0 commit comments

Comments
 (0)