summaryrefslogtreecommitdiff
path: root/numpy/ma/tests
diff options
context:
space:
mode:
authorJarrod Millman <millman@berkeley.edu>2008-04-20 11:49:35 +0000
committerJarrod Millman <millman@berkeley.edu>2008-04-20 11:49:35 +0000
commit8c663313de36e860bbfea0909de181d330bfdfc7 (patch)
treea7b5f3585d2b8a2d8307bfb03dd0e449fa732860 /numpy/ma/tests
parentcb7de97f089b67eaacf37ddbebcfb91c292c0ef4 (diff)
downloadnumpy-8c663313de36e860bbfea0909de181d330bfdfc7.tar.gz
ran reindent in preparation for the 1.1 release
Diffstat (limited to 'numpy/ma/tests')
-rw-r--r--numpy/ma/tests/test_core.py2
-rw-r--r--numpy/ma/tests/test_extras.py8
-rw-r--r--numpy/ma/tests/test_mrecords.py40
3 files changed, 25 insertions, 25 deletions
diff --git a/numpy/ma/tests/test_core.py b/numpy/ma/tests/test_core.py
index e1d4048a8..bdbe896e7 100644
--- a/numpy/ma/tests/test_core.py
+++ b/numpy/ma/tests/test_core.py
@@ -848,7 +848,7 @@ class TestMA(NumpyTestCase):
assert_equal(xf.dtype, float_)
assert_equal(xs.data, ['A', 'b', 'pi'])
assert_equal(xs.dtype, '|S3')
-
+
#...............................................................................
diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py
index 2e1eebb04..fe0ef3b2e 100644
--- a/numpy/ma/tests/test_extras.py
+++ b/numpy/ma/tests/test_extras.py
@@ -324,7 +324,7 @@ class TestApplyAlongAxis(NumpyTestCase):
return b[1]
xa = apply_along_axis(myfunc,2,a)
assert_equal(xa,[[1,4],[7,10]])
-
+
class TestMedian(NumpyTestCase):
def __init__(self, *args, **kwds):
NumpyTestCase.__init__(self, *args, **kwds)
@@ -333,7 +333,7 @@ class TestMedian(NumpyTestCase):
"Tests median w/ 2D"
(n,p) = (101,30)
x = masked_array(numpy.linspace(-1.,1.,n),)
- x[:10] = x[-10:] = masked
+ x[:10] = x[-10:] = masked
z = masked_array(numpy.empty((n,p), dtype=numpy.float_))
z[:,0] = x[:]
idx = numpy.arange(len(x))
@@ -352,8 +352,8 @@ class TestMedian(NumpyTestCase):
assert_equal(median(x,0),[[99,10],[11,99],[13,14]])
x = numpy.ma.arange(24).reshape(4,3,2)
x[x%5==0] = masked
- assert_equal(median(x,0), [[12,10],[8,9],[16,17]])
-
+ assert_equal(median(x,0), [[12,10],[8,9],[16,17]])
+
###############################################################################
#------------------------------------------------------------------------------
diff --git a/numpy/ma/tests/test_mrecords.py b/numpy/ma/tests/test_mrecords.py
index 2f3931878..cb550a9aa 100644
--- a/numpy/ma/tests/test_mrecords.py
+++ b/numpy/ma/tests/test_mrecords.py
@@ -41,7 +41,7 @@ class TestMRecords(NumpyTestCase):
ddtype = [('a',int),('b',float),('c','|S8')]
mask = [0,1,0,0,1]
self.base = ma.array(zip(ilist,flist,slist), mask=mask, dtype=ddtype)
-
+
def test_byview(self):
"Test creation by view"
base = self.base
@@ -69,7 +69,7 @@ class TestMRecords(NumpyTestCase):
assert_equal(mbase_first.mask, nomask)
assert_equal(mbase_first._fieldmask.item(), (False, False, False))
assert_equal(mbase_first['a'], mbase['a'][0])
- mbase_last = mbase[-1]
+ mbase_last = mbase[-1]
assert isinstance(mbase_last, mrecarray)
assert_equal(mbase_last.dtype, mbase.dtype)
assert_equal(mbase_last.tolist(), (None,None,None))
@@ -87,7 +87,7 @@ class TestMRecords(NumpyTestCase):
assert_equal(getattr(mbase_sl,field), base[:2][field])
def test_set_fields(self):
- "Tests setting fields."
+ "Tests setting fields."
base = self.base.copy()
mbase = base.view(mrecarray)
mbase = mbase.copy()
@@ -101,7 +101,7 @@ class TestMRecords(NumpyTestCase):
assert_equal(mbase['a']._data, [1]*5)
assert_equal(ma.getmaskarray(mbase['a']), [0]*5)
assert_equal(mbase._mask, [False]*5)
- assert_equal(mbase._fieldmask.tolist(),
+ assert_equal(mbase._fieldmask.tolist(),
np.array([(0,0,0),(0,1,1),(0,0,0),(0,0,0),(0,1,1)],
dtype=bool))
# Set a field to mask ........................
@@ -109,7 +109,7 @@ class TestMRecords(NumpyTestCase):
assert_equal(mbase.c.mask, [1]*5)
assert_equal(ma.getmaskarray(mbase['c']), [1]*5)
assert_equal(ma.getdata(mbase['c']), ['N/A']*5)
- assert_equal(mbase._fieldmask.tolist(),
+ assert_equal(mbase._fieldmask.tolist(),
np.array([(0,0,1),(0,1,1),(0,0,1),(0,0,1),(0,1,1)],
dtype=bool))
# Set fields by slices .......................
@@ -129,12 +129,12 @@ class TestMRecords(NumpyTestCase):
assert_equal(ma.getmaskarray(mbase['b']), [1]*5)
assert_equal(mbase['a']._mask, mbase['b']._mask)
assert_equal(mbase['a']._mask, mbase['c']._mask)
- assert_equal(mbase._fieldmask.tolist(),
+ assert_equal(mbase._fieldmask.tolist(),
np.array([(1,1,1)]*5, dtype=bool))
# Delete the mask ............................
mbase._mask = nomask
assert_equal(ma.getmaskarray(mbase['c']), [0]*5)
- assert_equal(mbase._fieldmask.tolist(),
+ assert_equal(mbase._fieldmask.tolist(),
np.array([(0,0,0)]*5, dtype=bool))
#
def test_set_mask_fromarray(self):
@@ -154,7 +154,7 @@ class TestMRecords(NumpyTestCase):
def test_set_mask_fromfields(self):
mbase = self.base.copy().view(mrecarray)
#
- nmask = np.array([(0,1,0),(0,1,0),(1,0,1),(1,0,1),(0,0,0)],
+ nmask = np.array([(0,1,0),(0,1,0),(1,0,1),(1,0,1),(0,0,0)],
dtype=[('a',bool),('b',bool),('c',bool)])
mbase.mask = nmask
assert_equal(mbase.a.mask, [0,0,1,1,0])
@@ -240,8 +240,8 @@ class TestMRecords(NumpyTestCase):
_b = ma.array([1.1,2.2,3.3],mask=[0,0,1],dtype=float)
_c = ma.array(['one','two','three'],mask=[0,0,1],dtype='|S8')
ddtype = [('a',int),('b',float),('c','|S8')]
- mrec = fromarrays([_a,_b,_c], dtype=ddtype,
- fill_value=(99999,99999.,'N/A'))
+ mrec = fromarrays([_a,_b,_c], dtype=ddtype,
+ fill_value=(99999,99999.,'N/A'))
mrecfilled = mrec.filled()
assert_equal(mrecfilled['a'], np.array((1,2,99999), dtype=int))
assert_equal(mrecfilled['b'], np.array((1.1,2.2,99999.), dtype=float))
@@ -253,8 +253,8 @@ class TestMRecords(NumpyTestCase):
_b = ma.array([1.1,2.2,3.3],mask=[0,0,1],dtype=float)
_c = ma.array(['one','two','three'],mask=[1,0,0],dtype='|S8')
ddtype = [('a',int),('b',float),('c','|S8')]
- mrec = fromarrays([_a,_b,_c], dtype=ddtype,
- fill_value=(99999,99999.,'N/A'))
+ mrec = fromarrays([_a,_b,_c], dtype=ddtype,
+ fill_value=(99999,99999.,'N/A'))
#
assert_equal(mrec.tolist(),
[(1,1.1,None),(2,2.2,'two'),(None,None,'three')])
@@ -272,11 +272,11 @@ class TestMRecordsImport(NumpyTestCase):
_b = ma.array([1.1,2.2,3.3],mask=[0,0,1],dtype=float)
_c = ma.array(['one','two','three'],mask=[0,0,1],dtype='|S8')
ddtype = [('a',int),('b',float),('c','|S8')]
- mrec = fromarrays([_a,_b,_c], dtype=ddtype,
- fill_value=(99999,99999.,'N/A'))
+ mrec = fromarrays([_a,_b,_c], dtype=ddtype,
+ fill_value=(99999,99999.,'N/A'))
nrec = recfromarrays((_a.data,_b.data,_c.data), dtype=ddtype)
self.data = (mrec, nrec, ddtype)
-
+
def test_fromarrays(self):
_a = ma.array([1,2,3],mask=[0,0,1],dtype=int)
_b = ma.array([1.1,2.2,3.3],mask=[0,0,1],dtype=float)
@@ -284,8 +284,8 @@ class TestMRecordsImport(NumpyTestCase):
(mrec, nrec, _) = self.data
for (f,l) in zip(('a','b','c'),(_a,_b,_c)):
assert_equal(getattr(mrec,f)._mask, l._mask)
-
-
+
+
def test_fromrecords(self):
"Test construction from records."
(mrec, nrec, ddtype) = self.data
@@ -300,7 +300,7 @@ class TestMRecordsImport(NumpyTestCase):
_mrec = fromrecords(nrec)
assert_equal(_mrec.dtype, mrec.dtype)
for field in _mrec.dtype.names:
- assert_equal(getattr(_mrec, field), getattr(mrec._data, field))
+ assert_equal(getattr(_mrec, field), getattr(mrec._data, field))
#
_mrec = fromrecords(nrec.tolist(), names='c1,c2,c3')
assert_equal(_mrec.dtype, [('c1',int),('c2',float),('c3','|S5')])
@@ -311,7 +311,7 @@ class TestMRecordsImport(NumpyTestCase):
assert_equal(_mrec.dtype, mrec.dtype)
assert_equal_records(_mrec._data, mrec.filled())
assert_equal_records(_mrec._fieldmask, mrec._fieldmask)
-
+
def test_fromrecords_wmask(self):
"Tests construction from records w/ mask."
(mrec, nrec, ddtype) = self.data
@@ -328,7 +328,7 @@ class TestMRecordsImport(NumpyTestCase):
assert_equal_records(_mrec._data, mrec._data)
assert_equal(_mrec._fieldmask.tolist(), mrec._fieldmask.tolist())
#
- _mrec = fromrecords(nrec.tolist(), dtype=ddtype,
+ _mrec = fromrecords(nrec.tolist(), dtype=ddtype,
mask=mrec._fieldmask.tolist())
assert_equal_records(_mrec._data, mrec._data)
assert_equal(_mrec._fieldmask.tolist(), mrec._fieldmask.tolist())