Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TomNicholas committed Jul 31, 2024
1 parent 8c8d097 commit 4b7e367
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions xarray/tests/test_datatree.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ def test_bad_names(self):


class TestFamilyTree:
def test_dont_modify_parent_inplace(self):
# GH issue 9196
root = DataTree()
DataTree(name="child", parent=root)
assert root.children == {}

def test_dont_modify_children_inplace(self):
# GH issue 9196
child = DataTree()
DataTree(children={"child": child})
assert child.parent is None

def test_setparent_unnamed_child_node_fails(self):
john: DataTree = DataTree(name="john")
with pytest.raises(ValueError, match="unnamed"):
Expand Down

0 comments on commit 4b7e367

Please sign in to comment.