Skip to content

Commit

Permalink
Test dtype_numpy
Browse files Browse the repository at this point in the history
  • Loading branch information
danielballan committed Sep 20, 2024
1 parent 7493e2f commit 76e53f7
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions event_model/tests/test_em.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,3 +1021,48 @@ def test_resource_start_optional():
event_model.compose_resource(
spec="TEST", root="/", resource_path="", resource_kwargs={}
)


def test_dtype_numpy():
"Test schema validation for various values for dtype_numpy."
bundle = event_model.compose_run()
start_doc, compose_descriptor, compose_resource, compose_stop = bundle
assert bundle.start_doc is start_doc
assert bundle.compose_descriptor is compose_descriptor
assert bundle.compose_resource is compose_resource
assert bundle.compose_stop is compose_stop
compose_descriptor(
data_keys={
"image": {
"shape": [512, 512],
"dtype": "number",
"source": "...",
"external": "FILESTORE:",
},
},
name="missing_dtype_numpy",
)
compose_descriptor(
data_keys={
"image": {
"shape": [512, 512],
"dtype": "number",
"dtype_numpy": "<u8",
"source": "...",
"external": "FILESTORE:",
},
},
name="basic_dtype_numpy",
)
compose_descriptor(
data_keys={
"image": {
"shape": [512, 512],
"dtype": "number",
"dtype_numpy": [("a", "<u8"), ("b", "<f8")],
"source": "...",
"external": "FILESTORE:",
},
},
name="structured_dtype_numpy",
)

0 comments on commit 76e53f7

Please sign in to comment.