Skip to content

Commit

Permalink
Improve checking of attributes in test
Browse files Browse the repository at this point in the history
  • Loading branch information
dschwoerer committed May 3, 2022
1 parent a58d2a8 commit 0bbfce6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xemc3/test/test_load_real.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ def test_load_all():
bd = get_data()
result = xemc3.load.all(bd)
expected = xr.open_dataset(bd + ".nc")

# Remove changing attributes
changing = "software_version", "date_created", "id"
for a in changing:
assert a in result.attrs
result.attrs.pop(a, None)
expected.attrs.pop(a, None)

# Remove new attributes, so we don't have to regenerate the data that often
for k in list(result) + list(result.coords):
for a in list(result[k].attrs):
Expand All @@ -36,10 +44,6 @@ def test_load_all():
for a in list(result.attrs):
if a not in expected.attrs:
del result.attrs[a]
# Remove changing attributes
for a in "software_version", "date_created", "id":
del result.attrs[a]
del expected.attrs[a]

assert_identical(result, expected)

Expand Down

0 comments on commit 0bbfce6

Please sign in to comment.