Conditionally check if a warning is raised
(condition: bool, category: type[Warning], message: str)
| 168 | |
| 169 | @contextlib.contextmanager |
| 170 | def _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 | |
| 182 | def assert_scipy_sparse_matrix_deprecated(extra_condition: bool = True): |
no outgoing calls
no test coverage detected