-
Notifications
You must be signed in to change notification settings - Fork 28
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
Showing
2 changed files
with
29 additions
and
2 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,27 @@ | ||
from roman_datamodels import datamodels as rdm | ||
from roman_datamodels import maker_utils | ||
|
||
from romancal.regtest.regtestdata import compare_asdf | ||
|
||
|
||
def test_compare_asdf_identical(tmp_path): | ||
fn0 = tmp_path / "test0.asdf" | ||
fn1 = tmp_path / "test1.asdf" | ||
l2 = rdm.ImageModel(maker_utils.mk_level2_image(shape=(100, 100))) | ||
l2.save(fn0) | ||
l2.save(fn1) | ||
diff = compare_asdf(fn0, fn1) | ||
assert diff.identical, diff.report() | ||
|
||
|
||
def test_compare_asdf_differ(tmp_path): | ||
fn0 = tmp_path / "test0.asdf" | ||
fn1 = tmp_path / "test1.asdf" | ||
l2 = rdm.ImageModel(maker_utils.mk_level2_image(shape=(100, 100))) | ||
l2.save(fn0) | ||
l2.data += 1 * l2.data.unit | ||
l2.save(fn1) | ||
diff = compare_asdf(fn0, fn1) | ||
assert not diff.identical, diff.report() | ||
assert "arrays_differ" in diff.diff | ||
assert "root['roman']['data']" in diff.diff["arrays_differ"] |