From 3926a6c68334efd6334f998cfa03cf18a152a46f Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Mon, 9 Mar 2009 00:58:59 +0000 Subject: Add assert_ as a release safe version of assert for running tests. --- numpy/testing/utils.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'numpy/testing/utils.py') 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. -- cgit v1.2.1