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

Method test_context_manager

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

Source from the content-addressed store, hash-verified

1171 "assert_warns does not preserver warnings state")
1172
1173 def test_context_manager(self):
1174
1175 before_filters = sys.modules['warnings'].filters[:]
1176 with assert_warns(UserWarning):
1177 warnings.warn("yo")
1178 after_filters = sys.modules['warnings'].filters
1179
1180 def no_warnings():
1181 with assert_no_warnings():
1182 warnings.warn("yo")
1183
1184 assert_raises(AssertionError, no_warnings)
1185 assert_equal(before_filters, after_filters,
1186 "assert_warns does not preserver warnings state")
1187
1188 def test_args(self):
1189 def f(a=0, b=1):

Callers

nothing calls this directly

Calls 3

assert_warnsFunction · 0.90
assert_raisesFunction · 0.90
assert_equalFunction · 0.90

Tested by

no test coverage detected