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

Function _check_warning

dask/utils_test.py:155–164  ·  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

153
154@contextlib.contextmanager
155def _check_warning(condition: bool, category: type[Warning], message: str):
156 """Conditionally check if a warning is raised"""
157 if condition:
158 import pytest
159
160 with pytest.warns(category, match=message) as ctx:
161 yield ctx
162 else:
163 with contextlib.nullcontext() as ctx:
164 yield ctx

Callers 1

test__check_warningFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected