MCPcopy Index your code
hub / github.com/pydata/xarray / test_kwargs

Method test_kwargs

xarray/tests/test_datatree.py:1835–1846  ·  view source on GitHub ↗
(self, create_test_datatree: Callable[[], DataTree])

Source from the content-addressed store, hash-verified

1833 assert actual["arr_with_attrs"].attrs == dict(x=1, y=2)
1834
1835 def test_kwargs(self, create_test_datatree: Callable[[], DataTree]) -> None:
1836 dt = create_test_datatree()
1837
1838 def f(tree: DataTree, *, x: int, y: int, z: int) -> DataTree:
1839 return tree.assign(
1840 arr_with_attrs=xr.Variable("dim0", [], attrs=dict(x=x, y=y, z=z))
1841 )
1842
1843 attrs = {"x": 1, "y": 2, "z": 3}
1844
1845 actual = dt.pipe(f, **attrs)
1846 assert actual["arr_with_attrs"].attrs == attrs
1847
1848 def test_args_kwargs(self, create_test_datatree: Callable[[], DataTree]) -> None:
1849 dt = create_test_datatree()

Callers

nothing calls this directly

Calls 2

create_test_datatreeFunction · 0.85
pipeMethod · 0.45

Tested by

no test coverage detected