diff options
author | cookedm <cookedm@localhost> | 2006-03-10 21:31:27 +0000 |
---|---|---|
committer | cookedm <cookedm@localhost> | 2006-03-10 21:31:27 +0000 |
commit | bf57380caa818b73a4c41409de6ff260425f9bb6 (patch) | |
tree | b2c42e0fde172de5def0c91811845808c00e296e /numpy/lib/tests | |
parent | f2db317c1fad63f1c85944ba8443b465e32774dc (diff) | |
download | numpy-bf57380caa818b73a4c41409de6ff260425f9bb6.tar.gz |
Run reindent.py (script distributed with Python) over the source to remove extraneous whitespace
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_arraysetops.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 126 | ||||
-rw-r--r-- | numpy/lib/tests/test_shape_base.py | 6 | ||||
-rw-r--r-- | numpy/lib/tests/test_twodim_base.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_type_check.py | 46 |
5 files changed, 91 insertions, 91 deletions
diff --git a/numpy/lib/tests/test_arraysetops.py b/numpy/lib/tests/test_arraysetops.py index 1c013619b..22f0a043c 100644 --- a/numpy/lib/tests/test_arraysetops.py +++ b/numpy/lib/tests/test_arraysetops.py @@ -129,7 +129,7 @@ class test_aso( ScipyTestCase ): b = numpy.fix( nItem / 10 * numpy.random.random( nItem ) ) c1 = intersect1d_nu( a, b ) - c2 = unique1d( intersect1d( a, b ) ) + c2 = unique1d( intersect1d( a, b ) ) assert_array_equal( c1, c2 ) a = numpy.array( [5, 7, 1, 2, 8] ) diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 41cdf45b4..592bd99e7 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -22,7 +22,7 @@ class test_any(ScipyTestCase): assert(any(y1)) assert_array_equal(sometrue(y1),[1,1,0]) assert_array_equal(sometrue(y1,axis=1),[0,1,1]) - + class test_all(ScipyTestCase): def check_basic(self): y1 = [0,1,1,0] @@ -53,7 +53,7 @@ class test_average(ScipyTestCase): y4[1,0] = 2 assert_array_equal(y4.mean(0), average(y4, 0)) assert_array_equal(y4.mean(1), average(y4, 1)) - + y5 = rand(5,5) assert_array_equal(y5.mean(0), average(y5, 0)) assert_array_equal(y5.mean(1), average(y5, 1)) @@ -147,7 +147,7 @@ class test_prod(ScipyTestCase): self.failUnlessRaises(ArithmeticError, prod, a) else: assert_equal(prod(a),26400) - assert_array_equal(prod(a2,axis=0), + assert_array_equal(prod(a2,axis=0), array([50,36,84,180],ctype)) assert_array_equal(prod(a2,axis=-1),array([24, 1890, 600],ctype)) @@ -242,7 +242,7 @@ class test_extins(ScipyTestCase): insert(a,mask,0) insert(a,mask,c) assert_array_equal(a,ac) - + class test_vectorize(ScipyTestCase): def check_simple(self): def addsubtract(a,b): @@ -262,75 +262,75 @@ class test_vectorize(ScipyTestCase): f = vectorize(addsubtract) r = f([0,3,6,9],5) assert_array_equal(r,[5,8,1,4]) - + class test_unwrap(ScipyTestCase): - def check_simple(self): - #check that unwrap removes jumps greather that 2*pi - assert_array_equal(unwrap([1,1+2*pi]),[1,1]) - #check that unwrap maintans continuity - assert(all(diff(unwrap(rand(10)*100))<pi)) - + def check_simple(self): + #check that unwrap removes jumps greather that 2*pi + assert_array_equal(unwrap([1,1+2*pi]),[1,1]) + #check that unwrap maintans continuity + assert(all(diff(unwrap(rand(10)*100))<pi)) + class test_filterwindows(ScipyTestCase): - def check_hanning(self): - #check symmetry - w=hanning(10) - assert_array_almost_equal(w,flipud(w),7) - #check known value - assert_almost_equal(sum(w),4.500,4) - - def check_hamming(self): - #check symmetry - w=hamming(10) - assert_array_almost_equal(w,flipud(w),7) - #check known value - assert_almost_equal(sum(w),4.9400,4) - - def check_bartlett(self): - #check symmetry - w=bartlett(10) - assert_array_almost_equal(w,flipud(w),7) - #check known value - assert_almost_equal(sum(w),4.4444,4) - - def check_blackman(self): - #check symmetry - w=blackman(10) - assert_array_almost_equal(w,flipud(w),7) - #check known value - assert_almost_equal(sum(w),3.7800,4) - + def check_hanning(self): + #check symmetry + w=hanning(10) + assert_array_almost_equal(w,flipud(w),7) + #check known value + assert_almost_equal(sum(w),4.500,4) + + def check_hamming(self): + #check symmetry + w=hamming(10) + assert_array_almost_equal(w,flipud(w),7) + #check known value + assert_almost_equal(sum(w),4.9400,4) + + def check_bartlett(self): + #check symmetry + w=bartlett(10) + assert_array_almost_equal(w,flipud(w),7) + #check known value + assert_almost_equal(sum(w),4.4444,4) + + def check_blackman(self): + #check symmetry + w=blackman(10) + assert_array_almost_equal(w,flipud(w),7) + #check known value + assert_almost_equal(sum(w),3.7800,4) + class test_trapz(ScipyTestCase): - def check_simple(self): - r=trapz(exp(-1.0/2*(arange(-10,10,.1))**2)/sqrt(2*pi),dx=0.1) - #check integral of normal equals 1 - assert_almost_equal(sum(r),1,7) - + def check_simple(self): + r=trapz(exp(-1.0/2*(arange(-10,10,.1))**2)/sqrt(2*pi),dx=0.1) + #check integral of normal equals 1 + assert_almost_equal(sum(r),1,7) + class test_sinc(ScipyTestCase): - def check_simple(self): - assert(sinc(0)==1) - w=sinc(linspace(-1,1,100)) - #check symmetry - assert_array_almost_equal(w,flipud(w),7) + def check_simple(self): + assert(sinc(0)==1) + w=sinc(linspace(-1,1,100)) + #check symmetry + assert_array_almost_equal(w,flipud(w),7) class test_histogram(ScipyTestCase): - def check_simple(self): - n=100 - v=rand(n) - (a,b)=histogram(v) - #check if the sum of the bins equals the number of samples - assert(sum(a)==n) - #check that the bin counts are evenly spaced when the data is from a linear function - (a,b)=histogram(linspace(0,10,100)) - assert(all(a==10)) - - - - - + def check_simple(self): + n=100 + v=rand(n) + (a,b)=histogram(v) + #check if the sum of the bins equals the number of samples + assert(sum(a)==n) + #check that the bin counts are evenly spaced when the data is from a linear function + (a,b)=histogram(linspace(0,10,100)) + assert(all(a==10)) + + + + + def compare_results(res,desired): for i in range(len(desired)): assert_array_equal(res[i],desired[i]) diff --git a/numpy/lib/tests/test_shape_base.py b/numpy/lib/tests/test_shape_base.py index 11cf8fc91..953f9b277 100644 --- a/numpy/lib/tests/test_shape_base.py +++ b/numpy/lib/tests/test_shape_base.py @@ -118,7 +118,7 @@ class test_array_split(ScipyTestCase): desired = [array([]),arange(0,5),arange(5,7),arange(7,10), array([]),array([])] compare_results(res,desired) - + class test_split(ScipyTestCase): """* This function is essentially the same as array_split, except that it test if splitting will result in an @@ -131,7 +131,7 @@ class test_split(ScipyTestCase): compare_results(res,desired) def check_unequal_split(self): - a = arange(10) + a = arange(10) try: res = split(a,3) assert(0) # should raise an error @@ -353,7 +353,7 @@ class test_squeeze(ScipyTestCase): assert_array_equal(squeeze(a),reshape(a,(20,10,10))) assert_array_equal(squeeze(b),reshape(b,(20,10,20))) assert_array_equal(squeeze(c),reshape(c,(20,10))) - + # Utility def compare_results(res,desired): diff --git a/numpy/lib/tests/test_twodim_base.py b/numpy/lib/tests/test_twodim_base.py index e32f29478..4e5cdb54a 100644 --- a/numpy/lib/tests/test_twodim_base.py +++ b/numpy/lib/tests/test_twodim_base.py @@ -43,7 +43,7 @@ class test_eye(ScipyTestCase): [0,0,0]])) assert_equal(eye(3,4),array([[1,0,0,0], [0,1,0,0], - [0,0,1,0]])) + [0,0,1,0]])) def check_diag2d(self): assert_equal(eye(3,4,k=2),array([[0,0,1,0], [0,0,0,1], diff --git a/numpy/lib/tests/test_type_check.py b/numpy/lib/tests/test_type_check.py index 5d026a9f9..6d93989e5 100644 --- a/numpy/lib/tests/test_type_check.py +++ b/numpy/lib/tests/test_type_check.py @@ -10,7 +10,7 @@ restore_path() def assert_all(x): assert(all(x)), x - + class test_mintypecode(ScipyTestCase): def check_default_1(self): @@ -59,7 +59,7 @@ class test_mintypecode(ScipyTestCase): assert_equal(mintypecode('idF'),'D') #assert_equal(mintypecode('idF',savespace=1),'F') assert_equal(mintypecode('idD'),'D') - + class test_isscalar(ScipyTestCase): def check_basic(self): assert(isscalar(3)) @@ -125,12 +125,12 @@ class test_isnan(ScipyTestCase): def check_goodvalues(self): z = array((-1.,0.,1.)) res = isnan(z) == 0 - assert_all(alltrue(res)) - def check_posinf(self): + assert_all(alltrue(res)) + def check_posinf(self): assert_all(isnan(array((1.,))/0.) == 0) - def check_neginf(self): + def check_neginf(self): assert_all(isnan(array((-1.,))/0.) == 0) - def check_ind(self): + def check_ind(self): assert_all(isnan(array((0.,))/0.) == 1) #def check_qnan(self): log(-1) return pi*j now # assert_all(isnan(log(-1.)) == 1) @@ -140,19 +140,19 @@ class test_isnan(ScipyTestCase): assert_all(isnan(1+1j) == 0) def check_complex1(self): assert_all(isnan(array(0+0j)/0.) == 1) - + class test_isfinite(ScipyTestCase): def check_goodvalues(self): z = array((-1.,0.,1.)) res = isfinite(z) == 1 - assert_all(alltrue(res)) - def check_posinf(self): + assert_all(alltrue(res)) + def check_posinf(self): assert_all(isfinite(array((1.,))/0.) == 0) - def check_neginf(self): + def check_neginf(self): assert_all(isfinite(array((-1.,))/0.) == 0) - def check_ind(self): + def check_ind(self): assert_all(isfinite(array((0.,))/0.) == 0) - #def check_qnan(self): + #def check_qnan(self): # assert_all(isfinite(log(-1.)) == 0) def check_integer(self): assert_all(isfinite(1) == 1) @@ -160,23 +160,23 @@ class test_isfinite(ScipyTestCase): assert_all(isfinite(1+1j) == 1) def check_complex1(self): assert_all(isfinite(array(1+1j)/0.) == 0) - + class test_isinf(ScipyTestCase): def check_goodvalues(self): z = array((-1.,0.,1.)) res = isinf(z) == 0 - assert_all(alltrue(res)) - def check_posinf(self): + assert_all(alltrue(res)) + def check_posinf(self): assert_all(isinf(array((1.,))/0.) == 1) - def check_posinf_scalar(self): + def check_posinf_scalar(self): assert_all(isinf(array(1.,)/0.) == 1) - def check_neginf(self): + def check_neginf(self): assert_all(isinf(array((-1.,))/0.) == 1) - def check_neginf_scalar(self): + def check_neginf_scalar(self): assert_all(isinf(array(-1.)/0.) == 1) - def check_ind(self): + def check_ind(self): assert_all(isinf(array((0.,))/0.) == 0) - #def check_qnan(self): + #def check_qnan(self): # assert_all(isinf(log(-1.)) == 0) # assert_all(isnan(log(-1.)) == 1) @@ -216,12 +216,12 @@ class test_nan_to_num(ScipyTestCase): v = 1+1j v += array(-1+1.j)/0. vals = nan_to_num(v) - assert_all(isfinite(vals)) - #assert_all(vals.imag > 1e10) and assert_all(isfinite(vals)) + assert_all(isfinite(vals)) + #assert_all(vals.imag > 1e10) and assert_all(isfinite(vals)) # !! This is actually (unexpectedly) positive # !! inf. Comment out for now, and see if it # !! changes - #assert_all(vals.real < -1e10) and assert_all(isfinite(vals)) + #assert_all(vals.real < -1e10) and assert_all(isfinite(vals)) class test_real_if_close(ScipyTestCase): |