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

Function test_weighted_quantile_with_invalid_q

xarray/tests/test_weighted.py:345–355  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

343
344@pytest.mark.parametrize("q", (-1, 1.1, (0.5, 1.1), ((0.2, 0.4), (0.6, 0.8))))
345def test_weighted_quantile_with_invalid_q(q):
346 da = DataArray([1, 1.9, 2.2, 3, 3.7, 4.1, 5])
347 q = np.asarray(q)
348 weights = xr.ones_like(da)
349
350 if q.ndim <= 1:
351 with pytest.raises(ValueError, match="q values must be between 0 and 1"):
352 da.weighted(weights).quantile(q)
353 else:
354 with pytest.raises(ValueError, match="q must be a scalar or 1d"):
355 da.weighted(weights).quantile(q)
356
357
358@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 3

weightedMethod · 0.95
DataArrayClass · 0.90
quantileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…