Skip to content

Commit

Permalink
numpy assertion helpers ignore masks
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Jul 18, 2024
1 parent d693b19 commit 00c9703
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions asdf/_tests/tags/core/tests/test_ndarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from numpy.testing import assert_array_equal

import asdf
from asdf._tests._helpers import assert_tree_match
from asdf.exceptions import ValidationError
from asdf.extension import Converter, Extension, TagDefinition
from asdf.tags.core import ndarray
Expand Down Expand Up @@ -395,7 +394,10 @@ def test_mask_roundtrip(mask, tmp_path):
}

with roundtrip(tree) as af:
assert_tree_match(tree, af.tree)
# assert_array_equal ignores the mask, so use equality here
assert tree["masked"] == af["masked"]
# ensure tree validity
assert af["unmasked"] == af["masked"].data
assert len(af._blocks.blocks) == 2


Expand Down Expand Up @@ -527,7 +529,8 @@ def test_inline_masked_array(tmp_path):

with asdf.open(testfile) as f2:
assert len(list(f2._blocks.blocks)) == 0
assert_array_equal(f.tree["test"], f2.tree["test"])
# assert_array_equal ignores the mask, so use equality here
assert f.tree["test"] == f2.tree["test"]

with open(testfile, "rb") as fd:
assert b"null" in fd.read()
Expand Down

0 comments on commit 00c9703

Please sign in to comment.