Skip to content

Commit

Permalink
regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Jul 30, 2024
1 parent 8c8d097 commit 97b5aa9
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions xarray/tests/test_datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,24 @@ def test_roundtrip_unnamed_root(self, simple_datatree):
roundtrip = DataTree.from_dict(dt.to_dict())
assert roundtrip.equals(dt)

def test_insertion_order(self):
# regression test for GH issue #9276
reversed = DataTree.from_dict(
{
"/Homer/Bart": xr.Dataset({"age": 10}),
"/Homer": xr.Dataset({"age": 39}),
"/": xr.Dataset({"age": 83}),
}
)
expected = DataTree.from_dict(
{
"/": xr.Dataset({"age": 83}),
"/Homer": xr.Dataset({"age": 39}),
"/Homer/Bart": xr.Dataset({"age": 10}),
}
)
assert reversed.equals(expected)


class TestDatasetView:
def test_view_contents(self):
Expand Down

0 comments on commit 97b5aa9

Please sign in to comment.