summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2009-03-09 00:58:59 +0000
committerCharles Harris <charlesr.harris@gmail.com>2009-03-09 00:58:59 +0000
commit3926a6c68334efd6334f998cfa03cf18a152a46f (patch)
tree37ea361241280dafdc50c5525a3513c050ff95d6 /numpy/testing/utils.py
parent5a9fe508e8df1f5a9ed2e0fc33da1b2d72ef4590 (diff)
downloadnumpy-3926a6c68334efd6334f998cfa03cf18a152a46f.tar.gz
Add assert_ as a release safe version of assert for running tests.
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 27c371f1e..56512364d 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -12,10 +12,17 @@ __all__ = ['assert_equal', 'assert_almost_equal','assert_approx_equal',
'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', 'rand', 'rundocs', 'runstring', 'verbose', 'measure']
+ 'raises', 'rand', 'rundocs', 'runstring', 'verbose', 'measure',
+ 'assert_']
verbose = 0
+def assert_(val, msg) :
+ """Assert that works in release mode."""
+ if not val :
+ raise AssertionError(msg)
+
+
def rand(*args):
"""Returns an array of random numbers with the given shape.