MCPcopy Create free account
hub / github.com/pydata/xarray / test_zfill

Function test_zfill

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

Source from the content-addressed store, hash-verified

2135
2136
2137def test_zfill(dtype) -> None:
2138 values = xr.DataArray(["1", "22", "aaa", "333", "45678"]).astype(dtype)
2139
2140 result = values.str.zfill(5)
2141 expected = xr.DataArray(["00001", "00022", "00aaa", "00333", "45678"]).astype(dtype)
2142 assert result.dtype == expected.dtype
2143 assert_equal(result, expected)
2144
2145 result = values.str.zfill(3)
2146 expected = xr.DataArray(["001", "022", "aaa", "333", "45678"]).astype(dtype)
2147 assert result.dtype == expected.dtype
2148 assert_equal(result, expected)
2149
2150
2151def test_zfill_broadcast(dtype) -> None:

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
zfillMethod · 0.80
astypeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…