diff options
author | Pearu Peterson <pearu.peterson@gmail.com> | 2005-10-13 11:36:03 +0000 |
---|---|---|
committer | Pearu Peterson <pearu.peterson@gmail.com> | 2005-10-13 11:36:03 +0000 |
commit | 1bb2bc4125a803bbce59b3f0485af9f9b92858ed (patch) | |
tree | 0ac37e08f8949ae1eee89c50da587cf7d7092ba7 | |
parent | a0cf73d306900fead84790658cb94fbb11792f16 (diff) | |
download | numpy-1bb2bc4125a803bbce59b3f0485af9f9b92858ed.tar.gz |
Added initial scipy.basic.tests site.
-rw-r--r-- | scipy/basic/__init__.py | 3 | ||||
-rw-r--r-- | scipy/basic/setup.py | 5 | ||||
-rw-r--r-- | scipy/basic/tests/test_helper.py | 45 |
3 files changed, 53 insertions, 0 deletions
diff --git a/scipy/basic/__init__.py b/scipy/basic/__init__.py index d61b68fbe..2550e96c8 100644 --- a/scipy/basic/__init__.py +++ b/scipy/basic/__init__.py @@ -1 +1,4 @@ # To get sub-modules + +from scipy.test.testing import ScipyTest +test = ScipyTest('scipy.basic').test diff --git a/scipy/basic/setup.py b/scipy/basic/setup.py new file mode 100644 index 000000000..7cb22425a --- /dev/null +++ b/scipy/basic/setup.py @@ -0,0 +1,5 @@ +def configuration(parent_package='',top_path=None): + from scipy.distutils.misc_util import Configuration + config = Configuration('basic',parent_package,top_path) + config.add_data_dir('tests') + return config diff --git a/scipy/basic/tests/test_helper.py b/scipy/basic/tests/test_helper.py new file mode 100644 index 000000000..cd7dd67cc --- /dev/null +++ b/scipy/basic/tests/test_helper.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# Copied from fftpack.helper by Pearu Peterson, October 2005 +""" Test functions for fftpack.helper module +""" + +import sys +from scipy.test.testing import * +set_package_path() +from scipy.basic.helper import fftshift,ifftshift,fftfreq +del sys.path[0] + +from scipy import pi + +def random(size): + return rand(*size) + +class test_fftshift(ScipyTestCase): + + def check_definition(self): + x = [0,1,2,3,4,-4,-3,-2,-1] + y = [-4,-3,-2,-1,0,1,2,3,4] + assert_array_almost_equal(fftshift(x),y) + assert_array_almost_equal(ifftshift(y),x) + x = [0,1,2,3,4,-5,-4,-3,-2,-1] + y = [-5,-4,-3,-2,-1,0,1,2,3,4] + assert_array_almost_equal(fftshift(x),y) + assert_array_almost_equal(ifftshift(y),x) + + def check_inverse(self): + for n in [1,4,9,100,211]: + x = random((n,)) + assert_array_almost_equal(ifftshift(fftshift(x)),x) + +class test_fftfreq(ScipyTestCase): + + def check_definition(self): + x = [0,1,2,3,4,-4,-3,-2,-1] + assert_array_almost_equal(9*fftfreq(9),x) + assert_array_almost_equal(9*pi*fftfreq(9,pi),x) + x = [0,1,2,3,4,-5,-4,-3,-2,-1] + assert_array_almost_equal(10*fftfreq(10),x) + assert_array_almost_equal(10*pi*fftfreq(10,pi),x) + +if __name__ == "__main__": + ScipyTest().run() |