MCPcopy Index your code
hub / github.com/numpy/numpy / test_warn

Method test_warn

numpy/testing/tests/test_utils.py:1157–1171  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1155class TestWarns:
1156
1157 def test_warn(self):
1158 def f():
1159 warnings.warn("yo")
1160 return 3
1161
1162 before_filters = sys.modules['warnings'].filters[:]
1163 assert_equal(assert_warns(UserWarning, f), 3)
1164 after_filters = sys.modules['warnings'].filters
1165
1166 assert_raises(AssertionError, assert_no_warnings, f)
1167 assert_equal(assert_no_warnings(lambda x: x, 1), 1)
1168
1169 # Check that the warnings state is unchanged
1170 assert_equal(before_filters, after_filters,
1171 "assert_warns does not preserver warnings state")
1172
1173 def test_context_manager(self):
1174

Callers

nothing calls this directly

Calls 4

assert_equalFunction · 0.90
assert_warnsFunction · 0.90
assert_raisesFunction · 0.90
assert_no_warningsFunction · 0.90

Tested by

no test coverage detected