From 0b5a6645ee110a8d4c6b5defd8c01791ee48bda1 Mon Sep 17 00:00:00 2001 From: Charles Harris Date: Wed, 30 Jul 2014 15:14:11 -0600 Subject: STY: PEP8 compliance for numpy/lib/tests. The possibly controversial part of this is making the nested array value lists PEP8 compliant, as there is something to be said aligning the values for clarity. In the end, it seemed like the easiest thing to do was to make them PEP8 compliant. The eye can get used to that. --- numpy/lib/tests/test_nanfunctions.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'numpy/lib/tests/test_nanfunctions.py') diff --git a/numpy/lib/tests/test_nanfunctions.py b/numpy/lib/tests/test_nanfunctions.py index c5af61434..3da6b5149 100644 --- a/numpy/lib/tests/test_nanfunctions.py +++ b/numpy/lib/tests/test_nanfunctions.py @@ -10,17 +10,17 @@ from numpy.testing import ( # Test data -_ndat = np.array([[0.6244, np.nan, 0.2692, 0.0116, np.nan, 0.1170], - [0.5351, -0.9403, np.nan, 0.2100, 0.4759, 0.2833], - [np.nan, np.nan, np.nan, 0.1042, np.nan, -0.5954], - [0.1610, np.nan, np.nan, 0.1859, 0.3146, np.nan]]) +_ndat = np.array([[0.6244, np.nan, 0.2692, 0.0116, np.nan, 0.1170], + [0.5351, -0.9403, np.nan, 0.2100, 0.4759, 0.2833], + [np.nan, np.nan, np.nan, 0.1042, np.nan, -0.5954], + [0.1610, np.nan, np.nan, 0.1859, 0.3146, np.nan]]) # Rows of _ndat with nans removed -_rdat = [np.array([ 0.6244, 0.2692, 0.0116, 0.1170]), - np.array([ 0.5351, -0.9403, 0.2100, 0.4759, 0.2833]), - np.array([ 0.1042, -0.5954]), - np.array([ 0.1610, 0.1859, 0.3146])] +_rdat = [np.array([0.6244, 0.2692, 0.0116, 0.1170]), + np.array([0.5351, -0.9403, 0.2100, 0.4759, 0.2833]), + np.array([0.1042, -0.5954]), + np.array([0.1610, 0.1859, 0.3146])] class TestNanFunctions_MinMax(TestCase): @@ -205,7 +205,7 @@ class TestNanFunctions_IntTypes(TestCase): int_types = (np.int8, np.int16, np.int32, np.int64, np.uint8, np.uint16, np.uint32, np.uint64) - mat = np.array([127, 39, 93, 87, 46]) + mat = np.array([127, 39, 93, 87, 46]) def integer_arrays(self): for dtype in self.int_types: @@ -383,13 +383,13 @@ class TestNanFunctions_MeanVarStd(TestCase): def test_dtype_error(self): for f in self.nanfuncs: for dtype in [np.bool_, np.int_, np.object]: - assert_raises( TypeError, f, _ndat, axis=1, dtype=np.int) + assert_raises(TypeError, f, _ndat, axis=1, dtype=np.int) def test_out_dtype_error(self): for f in self.nanfuncs: for dtype in [np.bool_, np.int_, np.object]: out = np.empty(_ndat.shape[0], dtype=dtype) - assert_raises( TypeError, f, _ndat, axis=1, out=out) + assert_raises(TypeError, f, _ndat, axis=1, out=out) def test_keepdims(self): mat = np.eye(3) @@ -587,7 +587,7 @@ class TestNanFunctions_Median(TestCase): # Randomly set some elements to NaN: w = np.random.randint(0, d.size, size=d.size // 5) d.ravel()[w] = np.nan - d[:,0] = 1. # ensure at least one good value + d[:,0] = 1. # ensure at least one good value # use normal median without nans to compare tgt = [] for x in d: -- cgit v1.2.1