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. Parameters ----------
(*args, **kwargs)
| 2078 | |
| 2079 | |
| 2080 | def assert_no_warnings(*args, **kwargs): |
| 2081 | """ |
| 2082 | Fail if the given callable produces any warnings. |
| 2083 | |
| 2084 | If called with all arguments omitted, may be used as a context manager:: |
| 2085 | |
| 2086 | with assert_no_warnings(): |
| 2087 | do_something() |
| 2088 | |
| 2089 | The ability to be used as a context manager is new in NumPy v1.11.0. |
| 2090 | |
| 2091 | Parameters |
| 2092 | ---------- |
| 2093 | func : callable |
| 2094 | The callable to test. |
| 2095 | \\*args : Arguments |
| 2096 | Arguments passed to `func`. |
| 2097 | \\*\\*kwargs : Kwargs |
| 2098 | Keyword arguments passed to `func`. |
| 2099 | |
| 2100 | Returns |
| 2101 | ------- |
| 2102 | The value returned by `func`. |
| 2103 | |
| 2104 | """ |
| 2105 | if not args: |
| 2106 | return _assert_no_warnings_context() |
| 2107 | |
| 2108 | func = args[0] |
| 2109 | args = args[1:] |
| 2110 | with _assert_no_warnings_context(name=func.__name__): |
| 2111 | return func(*args, **kwargs) |
| 2112 | |
| 2113 | |
| 2114 | def _gen_alignment_data(dtype=float32, type='binary', max_size=24): |
searching dependent graphs…