diff options
author | Alan McIntyre <alan.mcintyre@local> | 2008-06-17 00:23:20 +0000 |
---|---|---|
committer | Alan McIntyre <alan.mcintyre@local> | 2008-06-17 00:23:20 +0000 |
commit | c331857d8663ecf54bbe88c834755da749e8ab52 (patch) | |
tree | f4cc69ec328a5ff4d3b108f3610acb119a196493 /numpy/fft | |
parent | 22ba7886a84dc6a16ca75871f7cd2f10ef8de1f9 (diff) | |
download | numpy-c331857d8663ecf54bbe88c834755da749e8ab52.tar.gz |
Switched to use nose to run tests. Added test and bench functions to all modules.
Diffstat (limited to 'numpy/fft')
-rw-r--r-- | numpy/fft/__init__.py | 6 | ||||
-rw-r--r-- | numpy/fft/tests/test_fftpack.py | 12 | ||||
-rw-r--r-- | numpy/fft/tests/test_helper.py | 16 |
3 files changed, 18 insertions, 16 deletions
diff --git a/numpy/fft/__init__.py b/numpy/fft/__init__.py index 0c5a7f2ed..d7f6c3d87 100644 --- a/numpy/fft/__init__.py +++ b/numpy/fft/__init__.py @@ -4,6 +4,6 @@ from info import __doc__ from fftpack import * from helper import * -def test(level=1, verbosity=1): - from numpy.testing import NumpyTest - return NumpyTest().test(level, verbosity) +from numpy.testing.pkgtester import Tester +test = Tester().test +bench = Tester().bench diff --git a/numpy/fft/tests/test_fftpack.py b/numpy/fft/tests/test_fftpack.py index d1409bd69..149611e6a 100644 --- a/numpy/fft/tests/test_fftpack.py +++ b/numpy/fft/tests/test_fftpack.py @@ -10,15 +10,17 @@ def fft1(x): phase = np.arange(L).reshape(-1,1) * phase return np.sum(x*np.exp(phase),axis=1) -class TestFFTShift(NumpyTestCase): - def check_fft_n(self): +class TestFFTShift(TestCase): + def test_fft_n(self): self.failUnlessRaises(ValueError,np.fft.fft,[1,2,3],0) -class TestFFT1D(NumpyTestCase): - def check_basic(self): + +class TestFFT1D(TestCase): + def test_basic(self): rand = np.random.random x = rand(30) + 1j*rand(30) assert_array_almost_equal(fft1(x), np.fft.fft(x)) + if __name__ == "__main__": - NumpyTest().run() + nose.run(argv=['', __file__]) diff --git a/numpy/fft/tests/test_helper.py b/numpy/fft/tests/test_helper.py index aaec6530a..42678fb79 100644 --- a/numpy/fft/tests/test_helper.py +++ b/numpy/fft/tests/test_helper.py @@ -7,16 +7,15 @@ import sys from numpy.testing import * set_package_path() from numpy.fft import fftshift,ifftshift,fftfreq -del sys.path[0] +restore_path() from numpy import pi def random(size): return rand(*size) -class TestFFTShift(NumpyTestCase): - - def check_definition(self): +class TestFFTShift(TestCase): + def test_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) @@ -26,14 +25,14 @@ class TestFFTShift(NumpyTestCase): assert_array_almost_equal(fftshift(x),y) assert_array_almost_equal(ifftshift(y),x) - def check_inverse(self): + def test_inverse(self): for n in [1,4,9,100,211]: x = random((n,)) assert_array_almost_equal(ifftshift(fftshift(x)),x) -class TestFFTFreq(NumpyTestCase): - def check_definition(self): +class TestFFTFreq(TestCase): + def test_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) @@ -41,5 +40,6 @@ class TestFFTFreq(NumpyTestCase): assert_array_almost_equal(10*fftfreq(10),x) assert_array_almost_equal(10*pi*fftfreq(10,pi),x) + if __name__ == "__main__": - NumpyTest().run() + nose.run(argv=['', __file__]) |