Skip to content

Commit 2be53fa

Browse files
committed
Test that shows default unstructure behavior
1 parent f14ed45 commit 2be53fa

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/test_cattrs.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,16 @@ def test_unstructure_xarray_tree():
7474
# the xarray as is.
7575
# This helps when finally converting the dictionary to MF6 input files.
7676
assert x_tree is f_dict["x"]
77+
78+
79+
def test_unstructure_xarray_tree_no_hook():
80+
x_arr = xr.DataArray([1, 2, 3])
81+
x_set = xr.Dataset({"x": x_arr})
82+
x_tree = xr.DataTree(x_set)
83+
f = Baz(x=x_tree)
84+
85+
f_dict = unstructure(f)
86+
87+
# Unfortunately the default converter seems to make a copy of the DataTree
88+
# and doesn't keep the original reference.
89+
assert x_tree is not f_dict["x"]

0 commit comments

Comments
 (0)