summaryrefslogtreecommitdiff
path: root/numpy/testing/_private/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/testing/_private/utils.py')
-rw-r--r--numpy/testing/_private/utils.py61
1 files changed, 1 insertions, 60 deletions
diff --git a/numpy/testing/_private/utils.py b/numpy/testing/_private/utils.py
index 2a2126503..351bd2a81 100644
--- a/numpy/testing/_private/utils.py
+++ b/numpy/testing/_private/utils.py
@@ -29,7 +29,7 @@ __all__ = [
'assert_array_equal', 'assert_array_less', 'assert_string_equal',
'assert_array_almost_equal', 'assert_raises', 'build_err_msg',
'decorate_methods', 'jiffies', 'memusage', 'print_assert_equal',
- 'raises', 'rundocs', 'runstring', 'verbose', 'measure',
+ 'rundocs', 'runstring', 'verbose', 'measure',
'assert_', 'assert_array_almost_equal_nulp', 'assert_raises_regex',
'assert_array_max_ulp', 'assert_warns', 'assert_no_warnings',
'assert_allclose', 'IgnoreException', 'clear_and_catch_warnings',
@@ -57,28 +57,6 @@ HAS_LAPACK64 = numpy.linalg.lapack_lite._ilp64
_OLD_PROMOTION = lambda: np._get_promotion_state() == 'legacy'
-def import_nose():
- """ Import nose only when needed.
- """
- nose_is_good = True
- minimum_nose_version = (1, 0, 0)
- try:
- import nose
- except ImportError:
- nose_is_good = False
- else:
- if nose.__versioninfo__ < minimum_nose_version:
- nose_is_good = False
-
- if not nose_is_good:
- msg = ('Need nose >= %d.%d.%d for tests - see '
- 'https://nose.readthedocs.io' %
- minimum_nose_version)
- raise ImportError(msg)
-
- return nose
-
-
def assert_(val, msg=''):
"""
Assert that works in release mode.
@@ -1305,43 +1283,6 @@ def rundocs(filename=None, raise_on_error=True):
raise AssertionError("Some doctests failed:\n%s" % "\n".join(msg))
-def raises(*args):
- """Decorator to check for raised exceptions.
-
- The decorated test function must raise one of the passed exceptions to
- pass. If you want to test many assertions about exceptions in a single
- test, you may want to use `assert_raises` instead.
-
- .. warning::
- This decorator is nose specific, do not use it if you are using a
- different test framework.
-
- Parameters
- ----------
- args : exceptions
- The test passes if any of the passed exceptions is raised.
-
- Raises
- ------
- AssertionError
-
- Examples
- --------
-
- Usage::
-
- @raises(TypeError, ValueError)
- def test_raises_type_error():
- raise TypeError("This test passes")
-
- @raises(Exception)
- def test_that_fails_by_passing():
- pass
-
- """
- nose = import_nose()
- return nose.tools.raises(*args)
-
#
# assert_raises and assert_raises_regex are taken from unittest.
#