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

Method test_args_kwargs

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

Source from the content-addressed store, hash-verified

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()
1850
1851 def f(tree: DataTree, x: int, *, y: int, z: int) -> DataTree:
1852 return tree.assign(
1853 arr_with_attrs=xr.Variable("dim0", [], attrs=dict(x=x, y=y, z=z))
1854 )
1855
1856 attrs = {"x": 1, "y": 2, "z": 3}
1857
1858 actual = dt.pipe(f, attrs["x"], y=attrs["y"], z=attrs["z"])
1859 assert actual["arr_with_attrs"].attrs == attrs
1860
1861 def test_named_self(self, create_test_datatree: Callable[[], DataTree]) -> None:
1862 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