diff options
author | Eric Jones <eric@enthought.com> | 2002-01-02 15:42:07 +0000 |
---|---|---|
committer | Eric Jones <eric@enthought.com> | 2002-01-02 15:42:07 +0000 |
commit | 7161eb8ef2587dea3e8066bf209d0fe715057d0c (patch) | |
tree | 92d4f5dd6eef0a682a7f7c0008b41f1875f78217 | |
parent | d58a351e8d758523bbfb6d97715004375912d4c5 (diff) | |
download | numpy-7161eb8ef2587dea3e8066bf209d0fe715057d0c.tar.gz |
encapsulated all Numeric specific code within a try/except so that most functionality can be used without Numeric installed
-rwxr-xr-x | scipy_test/scipy_test.py | 49 | ||||
-rwxr-xr-x | scipy_test/setup_scipy_test.py | 5 |
2 files changed, 28 insertions, 26 deletions
diff --git a/scipy_test/scipy_test.py b/scipy_test/scipy_test.py index 0743cd032..74e2a7ccb 100755 --- a/scipy_test/scipy_test.py +++ b/scipy_test/scipy_test.py @@ -1,6 +1,3 @@ -from Numeric import * -from fastumath import * - import os def remove_ignored_patterns(files,pattern): @@ -236,26 +233,32 @@ def assert_almost_equal(actual,desired,decimal=7,err_msg='',verbose=1): + '\nACTUAL: ' + str(actual) assert round(abs(desired - actual),decimal) == 0, msg - -def assert_array_equal(x,y): - try: - assert(alltrue(equal(shape(x),shape(y)))) - reduced = equal(x,y) - assert(alltrue(ravel(reduced))) - except ValueError: - print shape(x),shape(y) - raise ValueError, 'arrays are not equal' - -def assert_array_almost_equal(x,y,decimal=6): - try: - assert(alltrue(equal(shape(x),shape(y)))) - reduced = equal(around(abs(x-y),decimal)) - assert(alltrue(ravel(reduced))) - except ValueError: - print shape(x),shape(y) - print x, y - raise ValueError, 'arrays are not almost equal' - +try: + # Numeric specific tests + from Numeric import * + from fastumath import * + + def assert_array_equal(x,y): + try: + assert(alltrue(equal(shape(x),shape(y)))) + reduced = equal(x,y) + assert(alltrue(ravel(reduced))) + except ValueError: + print shape(x),shape(y) + raise ValueError, 'arrays are not equal' + + def assert_array_almost_equal(x,y,decimal=6): + try: + assert(alltrue(equal(shape(x),shape(y)))) + reduced = equal(around(abs(x-y),decimal)) + assert(alltrue(ravel(reduced))) + except ValueError: + print shape(x),shape(y) + print x, y + raise ValueError, 'arrays are not almost equal' +except: + pass # Numeric not installed + import traceback,sys def output_exception(): try: diff --git a/scipy_test/setup_scipy_test.py b/scipy_test/setup_scipy_test.py index 83c583ed3..9de504622 100755 --- a/scipy_test/setup_scipy_test.py +++ b/scipy_test/setup_scipy_test.py @@ -10,9 +10,8 @@ def configuration(parent_package=''): local_path = get_path(__name__) config = default_config_dict() - #config['packages'].append(parent_package+'scipy_test') - #config['packages'].append(parent_package) - config['package_dir'][''] = local_path + config['packages'].append(parent_package+'scipy_test') + config['package_dir'][parent_package+'scipy_test'] = local_path return config def install_package(): |