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

Function assert_no_warnings

numpy/testing/_private/utils.py:1791–1824  ·  view source on GitHub ↗

Fail if the given callable produces any warnings. If called with all arguments omitted, may be used as a context manager: with assert_no_warnings(): do_something() The ability to be used as a context manager is new in NumPy v1.11.0. .. versionadded:: 1.7.0

(*args, **kwargs)

Source from the content-addressed store, hash-verified

1789
1790
1791def assert_no_warnings(*args, **kwargs):
1792 """
1793 Fail if the given callable produces any warnings.
1794
1795 If called with all arguments omitted, may be used as a context manager:
1796
1797 with assert_no_warnings():
1798 do_something()
1799
1800 The ability to be used as a context manager is new in NumPy v1.11.0.
1801
1802 .. versionadded:: 1.7.0
1803
1804 Parameters
1805 ----------
1806 func : callable
1807 The callable to test.
1808 \\*args : Arguments
1809 Arguments passed to `func`.
1810 \\*\\*kwargs : Kwargs
1811 Keyword arguments passed to `func`.
1812
1813 Returns
1814 -------
1815 The value returned by `func`.
1816
1817 """
1818 if not args:
1819 return _assert_no_warnings_context()
1820
1821 func = args[0]
1822 args = args[1:]
1823 with _assert_no_warnings_context(name=func.__name__):
1824 return func(*args, **kwargs)
1825
1826
1827def _gen_alignment_data(dtype=float32, type='binary', max_size=24):

Callers 13

test_ragged_shuffleFunction · 0.90
test_safe_castingMethod · 0.90
test_log_valuesMethod · 0.90
test_no_fpeMethod · 0.90
test_warnMethod · 0.90

Calls 2

funcFunction · 0.50

Tested by 13

test_ragged_shuffleFunction · 0.72
test_safe_castingMethod · 0.72
test_log_valuesMethod · 0.72
test_no_fpeMethod · 0.72
test_warnMethod · 0.72