MCPcopy Create free account
hub / github.com/dask/dask / _check_warning

Function _check_warning

dask/utils_test.py:170–179  ·  view source on GitHub ↗

Conditionally check if a warning is raised

(condition: bool, category: type[Warning], message: str)

Source from the content-addressed store, hash-verified

168
169@contextlib.contextmanager
170def _check_warning(condition: bool, category: type[Warning], message: str):
171 """Conditionally check if a warning is raised"""
172 if condition:
173 import pytest
174
175 with pytest.warns(category, match=message) as ctx:
176 yield ctx
177 else:
178 with contextlib.nullcontext() as ctx:
179 yield ctx
180
181
182def assert_scipy_sparse_matrix_deprecated(extra_condition: bool = True):

Callers 2

test__check_warningFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected