Skip to content

Commit ab09d5a

Browse files
committed
Add test case
1 parent 9337b33 commit ab09d5a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test/core/test_dataset.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,16 @@ def test_sel_method_forwarded(gridpath, datasetpath):
9999
nearest["time"].values,
100100
np.array(uxds["time"].values[2], dtype="datetime64[ns]"),
101101
)
102+
103+
def test_uxdataset_init_from_xarray_dataset():
104+
ds = xr.Dataset(
105+
data_vars={"a": ("x", [1, 2])},
106+
coords={"x": [10, 20]},
107+
attrs={"source": "testing"},
108+
)
109+
110+
uxds = ux.UxDataset(ds)
111+
112+
assert "a" in uxds.data_vars
113+
assert "x" in uxds.coords
114+
assert uxds.attrs["source"] == "testing"

0 commit comments

Comments
 (0)