-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add unit test for masked array roundtripping
- Loading branch information
1 parent
9e91495
commit 4f56b44
Showing
1 changed file
with
26 additions
and
0 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
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) |