-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77d63b0
commit 5fe2425
Showing
2 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import pytest | ||
|
||
from yt_napari._data_model import InputModel | ||
from yt_napari._model_ingestor import _choose_ref_layer, _process_validated_model | ||
from yt_napari._schema_version import schema_name | ||
|
||
jdicts = [] | ||
jdicts.append( | ||
{ | ||
"$schema": schema_name, | ||
"datasets": [ | ||
{ | ||
"filename": "_ytnapari_load_grid", | ||
"selections": { | ||
"covering_grids": [ | ||
{ | ||
"fields": [{"field_name": "density", "field_type": "gas"}], | ||
"left_edge": {"value": (0.4, 0.4, 0.4)}, | ||
"right_edge": {"value": (0.5, 0.5, 0.5)}, | ||
"level": 0, | ||
"rescale": 1, | ||
} | ||
] | ||
}, | ||
} | ||
], | ||
} | ||
) | ||
|
||
|
||
@pytest.mark.parametrize("jdict", jdicts) | ||
def test_covering_grid_validation(jdict): | ||
_ = InputModel.model_validate(jdict) | ||
|
||
|
||
@pytest.mark.parametrize("jdict", jdicts) | ||
def test_slice_load(yt_ugrid_ds_fn, jdict): | ||
im = InputModel.model_validate(jdict) | ||
layer_lists, _ = _process_validated_model(im) | ||
ref_layer = _choose_ref_layer(layer_lists) | ||
_ = ref_layer.align_sanitize_layers(layer_lists) | ||
|
||
im_data = layer_lists[0][0] | ||
assert im_data.min() == 0 | ||
assert im_data.max() == 1 |