diff options
author | Stephan Hoyer <shoyer@google.com> | 2016-09-26 09:04:08 -0700 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2016-09-26 10:26:52 -0700 |
commit | c9895bcf50ee0a7e0b9f4fe019860f16c3515ec7 (patch) | |
tree | fddb2d6fa73222c4b3cfc569e4434da375302198 /numpy/lib/tests/test_utils.py | |
parent | 0887da9386e812d2769744afd6c58a927d6cbb45 (diff) | |
download | numpy-c9895bcf50ee0a7e0b9f4fe019860f16c3515ec7.tar.gz |
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.
Diffstat (limited to 'numpy/lib/tests/test_utils.py')
-rw-r--r-- | numpy/lib/tests/test_utils.py | 7 |
1 files changed, 6 insertions, 1 deletions
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() |