diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2015-07-04 23:37:03 -0600 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2015-07-25 11:39:05 -0600 |
commit | b733a10a9cc806f4772728015ec1bd9e63322858 (patch) | |
tree | 8fc2664d6273176c5115df597fc347cdd043a88a /numpy/ma/tests/test_extras.py | |
parent | e79d6e306c675eee852a8ebaa26a137d4296841a (diff) | |
download | numpy-b733a10a9cc806f4772728015ec1bd9e63322858.tar.gz |
STY,MAINT: Run pyflakes and pep8 on numpy/ma/tests/*.
Also fix "*" imports.
The formatting of test arrays is not fixed for multiple spaces following
"," and other violations that are common in tests. To be precise, E241
and E201 are added to the errors that are excluded.
Diffstat (limited to 'numpy/ma/tests/test_extras.py')
-rw-r--r-- | numpy/ma/tests/test_extras.py | 59 |
1 files changed, 27 insertions, 32 deletions
diff --git a/numpy/ma/tests/test_extras.py b/numpy/ma/tests/test_extras.py index 3c7b95c9e..b6d902995 100644 --- a/numpy/ma/tests/test_extras.py +++ b/numpy/ma/tests/test_extras.py @@ -9,30 +9,27 @@ Adapted from the original test_ma by Pierre Gerard-Marchant """ from __future__ import division, absolute_import, print_function -__author__ = "Pierre GF Gerard-Marchant ($Author: jarrod.millman $)" -__version__ = '1.0' -__revision__ = "$Revision: 3473 $" -__date__ = '$Date: 2007-10-29 17:18:13 +0200 (Mon, 29 Oct 2007) $' - import warnings import numpy as np -from numpy.testing import (TestCase, run_module_suite, assert_warns, - assert_raises, clear_and_catch_warnings) -from numpy.ma.testutils import (rand, assert_, assert_array_equal, - assert_equal, assert_almost_equal) -from numpy.ma.core import (array, arange, masked, MaskedArray, masked_array, - getmaskarray, shape, nomask, ones, zeros, count) -import numpy.ma.extras as mae +from numpy.testing import ( + TestCase, run_module_suite, assert_warns, clear_and_catch_warnings + ) +from numpy.ma.testutils import ( + assert_, assert_array_equal, assert_equal, assert_almost_equal + ) +from numpy.ma.core import ( + array, arange, masked, MaskedArray, masked_array, getmaskarray, shape, + nomask, ones, zeros, count + ) from numpy.ma.extras import ( - atleast_2d, mr_, dot, polyfit, - cov, corrcoef, median, average, - unique, setxor1d, setdiff1d, union1d, intersect1d, in1d, ediff1d, - apply_over_axes, apply_along_axis, - compress_nd, compress_rowcols, mask_rowcols, - clump_masked, clump_unmasked, - flatnotmasked_contiguous, notmasked_contiguous, notmasked_edges, - masked_all, masked_all_like) + atleast_2d, mr_, dot, polyfit, cov, corrcoef, median, average, unique, + setxor1d, setdiff1d, union1d, intersect1d, in1d, ediff1d, + apply_over_axes, apply_along_axis, compress_nd, compress_rowcols, + mask_rowcols, clump_masked, clump_unmasked, flatnotmasked_contiguous, + notmasked_contiguous, notmasked_edges, masked_all, masked_all_like + ) +import numpy.ma.extras as mae class TestGeneric(TestCase): @@ -267,10 +264,10 @@ class TestConcatenator(TestCase): def test_2d(self): # Tests mr_ on 2D arrays. - a_1 = rand(5, 5) - a_2 = rand(5, 5) - m_1 = np.round_(rand(5, 5), 0) - m_2 = np.round_(rand(5, 5), 0) + a_1 = np.random.rand(5, 5) + a_2 = np.random.rand(5, 5) + m_1 = np.round_(np.random.rand(5, 5), 0) + m_2 = np.round_(np.random.rand(5, 5), 0) b_1 = masked_array(a_1, mask=m_1) b_2 = masked_array(a_2, mask=m_2) # append columns @@ -358,13 +355,13 @@ class TestCompressFunctions(TestCase): # axis=None a = compress_nd(x) - assert_equal(a, [[[ 0, 2, 3 , 4], + assert_equal(a, [[[ 0, 2, 3, 4], [10, 12, 13, 14], [15, 17, 18, 19]], [[40, 42, 43, 44], [50, 52, 53, 54], [55, 57, 58, 59]]]) - + # axis=0 a = compress_nd(x, 0) assert_equal(a, [[[ 0, 1, 2, 3, 4], @@ -449,8 +446,8 @@ class TestCompressFunctions(TestCase): # axis=(0, 2) a = compress_nd(x, (0, 2)) - assert_equal(a, [[[ 0, 2, 3, 4], - [ 5, 7, 8, 9], + assert_equal(a, [[[ 0, 2, 3, 4], + [ 5, 7, 8, 9], [10, 12, 13, 14], [15, 17, 18, 19]], [[40, 42, 43, 44], @@ -595,7 +592,7 @@ class TestApplyAlongAxis(TestCase): xa = apply_along_axis(myfunc, 2, a) assert_equal(xa, [[1, 4], [7, 10]]) - # Tests kwargs functions + # Tests kwargs functions def test_3d_kwargs(self): a = arange(12).reshape(2, 2, 3) @@ -1120,7 +1117,7 @@ class TestArraySetOps(TestCase): class TestShapeBase(TestCase): - # + def test_atleast2d(self): # Test atleast_2d a = masked_array([0, 1, 2], mask=[0, 1, 0]) @@ -1131,7 +1128,5 @@ class TestShapeBase(TestCase): assert_equal(a.mask.shape, a.data.shape) -############################################################################### -#------------------------------------------------------------------------------ if __name__ == "__main__": run_module_suite() |