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

Method test_warn_wrong_warning

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

Source from the content-addressed store, hash-verified

1207 assert "pytest.warns" not in str(exc)
1208
1209 def test_warn_wrong_warning(self):
1210 def f():
1211 warnings.warn("yo", DeprecationWarning)
1212
1213 failed = False
1214 with warnings.catch_warnings():
1215 warnings.simplefilter("error", DeprecationWarning)
1216 try:
1217 # Should raise a DeprecationWarning
1218 assert_warns(UserWarning, f)
1219 failed = True
1220 except DeprecationWarning:
1221 pass
1222
1223 if failed:
1224 raise AssertionError("wrong warning caught by assert_warn")
1225
1226
1227class TestAssertAllclose:

Callers

nothing calls this directly

Calls 1

assert_warnsFunction · 0.90

Tested by

no test coverage detected