summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/testing/tests/test_utils.py')
-rw-r--r--numpy/testing/tests/test_utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index bff8b50ab..23b2f8e7b 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -317,11 +317,15 @@ class TestWarns(unittest.TestCase):
def test_warn(self):
def f():
warnings.warn("yo")
+ return 3
before_filters = sys.modules['warnings'].filters[:]
- assert_warns(UserWarning, f)
+ assert_equal(assert_warns(UserWarning, f), 3)
after_filters = sys.modules['warnings'].filters
+ assert_raises(AssertionError, assert_no_warnings, f)
+ assert_equal(assert_no_warnings(lambda x: x, 1), 1)
+
# Check that the warnings state is unchanged
assert_equal(before_filters, after_filters,
"assert_warns does not preserver warnings state")