Skip to content

Commit

Permalink
add unit test for masked array roundtripping
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jul 17, 2024
1 parent 9e91495 commit 4f56b44
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions asdf/_tests/test_masked.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import numpy.ma
import pytest

import asdf
from asdf._tests._helpers import assert_tree_match


@pytest.mark.parametrize(
"mask",
[
[[False, False, True], [False, True, False], [False, False, False]],
True,
False,
],
)
def test_masked(mask, tmp_path):
tree = {
"a": 1,
"b": numpy.ma.array([[1, 0, 0], [0, 1, 0], [0, 0, 0]], mask=mask),
}
af = asdf.AsdfFile(tree)
fn = tmp_path / "masked.asdf"
af.write_to(fn)

with asdf.open(fn) as af:
assert_tree_match(tree, af.tree)

0 comments on commit 4f56b44

Please sign in to comment.