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

Function test_weighted_sum_equal_weights

xarray/tests/test_weighted.py:124–133  ·  view source on GitHub ↗
(da, factor, skipna)

Source from the content-addressed store, hash-verified

122@pytest.mark.parametrize("factor", [0, 1, 3.14])
123@pytest.mark.parametrize("skipna", (True, False))
124def test_weighted_sum_equal_weights(da, factor, skipna):
125 # if all weights are 'f'; weighted sum is f times the ordinary sum
126
127 da = DataArray(da)
128 weights = xr.full_like(da, factor)
129
130 expected = da.sum(skipna=skipna) * factor
131 result = da.weighted(weights).sum(skipna=skipna)
132
133 assert_equal(expected, result)
134
135
136@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

weightedMethod · 0.95
DataArrayClass · 0.90
assert_equalFunction · 0.90
sumMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…