MCPcopy
hub / github.com/pydata/xarray / test_slice_replace_broadcast

Function test_slice_replace_broadcast

xarray/tests/test_accessor_str.py:2235–2248  ·  view source on GitHub ↗
(dtype)

Source from the content-addressed store, hash-verified

2233
2234
2235def test_slice_replace_broadcast(dtype) -> None:
2236 values = xr.DataArray(["short", "a bit longer", "evenlongerthanthat", ""]).astype(
2237 dtype
2238 )
2239 start = 2
2240 stop = np.array([4, 5, None, 7])
2241 repl = "test"
2242
2243 expected = xr.DataArray(["shtestt", "a test longer", "evtest", "test"]).astype(
2244 dtype
2245 )
2246 result = values.str.slice_replace(start, stop, repl)
2247 assert result.dtype == expected.dtype
2248 assert_equal(result, expected)
2249
2250
2251def test_strip_lstrip_rstrip(dtype) -> None:

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
slice_replaceMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…