From c9895bcf50ee0a7e0b9f4fe019860f16c3515ec7 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Mon, 26 Sep 2016 09:04:08 -0700 Subject: MAINT: fix assert_raises_regex when used as a context manager Formerly, I got DeprecationWarnings about callable being None when I tested on Python 3. --- numpy/lib/tests/test_utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'numpy/lib/tests/test_utils.py') diff --git a/numpy/lib/tests/test_utils.py b/numpy/lib/tests/test_utils.py index 8fbd1c445..92bcdc238 100644 --- a/numpy/lib/tests/test_utils.py +++ b/numpy/lib/tests/test_utils.py @@ -3,7 +3,7 @@ from __future__ import division, absolute_import, print_function import sys from numpy.core import arange from numpy.testing import ( - run_module_suite, assert_, assert_equal, dec + run_module_suite, assert_, assert_equal, assert_raises_regex, dec ) from numpy.lib import deprecate import numpy.lib.utils as utils @@ -62,5 +62,10 @@ def test_byte_bounds(): assert_equal(high - low, a.size * a.itemsize) +def test_assert_raises_regex_context_manager(): + with assert_raises_regex(ValueError, 'no deprecation warning'): + raise ValueError('no deprecation warning') + + if __name__ == "__main__": run_module_suite() -- cgit v1.2.1