MCPcopy Create free account
hub / github.com/numpy/numpy / _assert_no_warnings_context

Function _assert_no_warnings_context

numpy/testing/_private/utils.py:1781–1788  ·  view source on GitHub ↗
(name=None)

Source from the content-addressed store, hash-verified

1779
1780@contextlib.contextmanager
1781def _assert_no_warnings_context(name=None):
1782 __tracebackhide__ = True # Hide traceback for py.test
1783 with warnings.catch_warnings(record=True) as l:
1784 warnings.simplefilter('always')
1785 yield
1786 if len(l) > 0:
1787 name_str = f' when calling {name}' if name is not None else ''
1788 raise AssertionError(f'Got warnings{name_str}: {l}')
1789
1790
1791def assert_no_warnings(*args, **kwargs):

Callers 1

assert_no_warningsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected