From dca44829a681fa8cebf541aa97e82907ae6f14ec Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Sat, 21 Apr 2012 16:34:01 -0400 Subject: [PATCH] untabify python test files --- libs/numpy/test/indexing.py | 74 +++++++++++++------------- libs/numpy/test/ndarray.py | 100 ++++++++++++++++++------------------ libs/numpy/test/shapes.py | 14 ++--- 3 files changed, 94 insertions(+), 94 deletions(-) diff --git a/libs/numpy/test/indexing.py b/libs/numpy/test/indexing.py index b51ae7e3..ccbf335b 100644 --- a/libs/numpy/test/indexing.py +++ b/libs/numpy/test/indexing.py @@ -6,45 +6,45 @@ import indexing_mod class TestIndexing(unittest.TestCase): - def testSingle(self): - x = numpy.arange(0,10) - for i in range(0,10): - numpy.testing.assert_equal(indexing_mod.single(x,i), i) - for i in range(-10,0): - numpy.testing.assert_equal(indexing_mod.single(x,i),10+i) + def testSingle(self): + x = numpy.arange(0,10) + for i in range(0,10): + numpy.testing.assert_equal(indexing_mod.single(x,i), i) + for i in range(-10,0): + numpy.testing.assert_equal(indexing_mod.single(x,i),10+i) - def testSlice(self): - x = numpy.arange(0,10) - sl = slice(3,8) - b = [3,4,5,6,7] - numpy.testing.assert_equal(indexing_mod.slice(x,sl), b) + def testSlice(self): + x = numpy.arange(0,10) + sl = slice(3,8) + b = [3,4,5,6,7] + numpy.testing.assert_equal(indexing_mod.slice(x,sl), b) - def testStepSlice(self): - x = numpy.arange(0,10) - sl = slice(3,8,2) - b = [3,5,7] - numpy.testing.assert_equal(indexing_mod.slice(x,sl), b) + def testStepSlice(self): + x = numpy.arange(0,10) + sl = slice(3,8,2) + b = [3,5,7] + numpy.testing.assert_equal(indexing_mod.slice(x,sl), b) - def testIndex(self): - x = numpy.arange(0,10) - chk = numpy.array([3,4,5,6]) - numpy.testing.assert_equal(indexing_mod.indexarray(x,chk),chk) - chk = numpy.array([[0,1],[2,3]]) - numpy.testing.assert_equal(indexing_mod.indexarray(x,chk),chk) - x = numpy.arange(9).reshape(3,3) - y = numpy.array([0,1]) - z = numpy.array([0,2]) - chk = numpy.array([0,5]) - numpy.testing.assert_equal(indexing_mod.indexarray(x,y,z),chk) - x = numpy.arange(0,10) - b = x>4 - chk = numpy.array([5,6,7,8,9]) - numpy.testing.assert_equal(indexing_mod.indexarray(x,b),chk) - x = numpy.arange(9).reshape(3,3) - b = numpy.array([0,2]) - sl = slice(0,3) - chk = numpy.array([[0,1,2],[6,7,8]]) - numpy.testing.assert_equal(indexing_mod.indexslice(x,b,sl),chk) + def testIndex(self): + x = numpy.arange(0,10) + chk = numpy.array([3,4,5,6]) + numpy.testing.assert_equal(indexing_mod.indexarray(x,chk),chk) + chk = numpy.array([[0,1],[2,3]]) + numpy.testing.assert_equal(indexing_mod.indexarray(x,chk),chk) + x = numpy.arange(9).reshape(3,3) + y = numpy.array([0,1]) + z = numpy.array([0,2]) + chk = numpy.array([0,5]) + numpy.testing.assert_equal(indexing_mod.indexarray(x,y,z),chk) + x = numpy.arange(0,10) + b = x>4 + chk = numpy.array([5,6,7,8,9]) + numpy.testing.assert_equal(indexing_mod.indexarray(x,b),chk) + x = numpy.arange(9).reshape(3,3) + b = numpy.array([0,2]) + sl = slice(0,3) + chk = numpy.array([[0,1,2],[6,7,8]]) + numpy.testing.assert_equal(indexing_mod.indexslice(x,b,sl),chk) if __name__=="__main__": - unittest.main() + unittest.main() diff --git a/libs/numpy/test/ndarray.py b/libs/numpy/test/ndarray.py index 2ae52b5b..f989f0ac 100644 --- a/libs/numpy/test/ndarray.py +++ b/libs/numpy/test/ndarray.py @@ -5,60 +5,60 @@ import unittest import numpy class TestNdarray(unittest.TestCase): - - def testNdzeros(self): - for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): - v = numpy.zeros(60, dtype=dtp) - dt = numpy.dtype(dtp) - for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)): - a1 = ndarray_mod.zeros(shape,dt) - a2 = v.reshape(a1.shape) - self.assertEqual(shape,a1.shape) - self.assert_((a1 == a2).all()) + + def testNdzeros(self): + for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): + v = numpy.zeros(60, dtype=dtp) + dt = numpy.dtype(dtp) + for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)): + a1 = ndarray_mod.zeros(shape,dt) + a2 = v.reshape(a1.shape) + self.assertEqual(shape,a1.shape) + self.assert_((a1 == a2).all()) - def testNdarray(self): - a = range(0,60) - for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): - v = numpy.array(a, dtype=dtp) - dt = numpy.dtype(dtp) - a1 = ndarray_mod.array(a) - a2 = ndarray_mod.array(a,dt) - self.assert_((a1 == v).all()) - self.assert_((a2 == v).all()) - for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)): - a1 = a1.reshape(shape) - self.assertEqual(shape,a1.shape) - a2 = a2.reshape(shape) - self.assertEqual(shape,a2.shape) + def testNdarray(self): + a = range(0,60) + for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): + v = numpy.array(a, dtype=dtp) + dt = numpy.dtype(dtp) + a1 = ndarray_mod.array(a) + a2 = ndarray_mod.array(a,dt) + self.assert_((a1 == v).all()) + self.assert_((a2 == v).all()) + for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)): + a1 = a1.reshape(shape) + self.assertEqual(shape,a1.shape) + a2 = a2.reshape(shape) + self.assertEqual(shape,a2.shape) - def testNdempty(self): - for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): - dt = numpy.dtype(dtp) - for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)): - a1 = ndarray_mod.empty(shape,dt) - a2 = ndarray_mod.c_empty(shape,dt) - self.assertEqual(shape,a1.shape) - self.assertEqual(shape,a2.shape) + def testNdempty(self): + for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): + dt = numpy.dtype(dtp) + for shape in ((60,),(6,10),(4,3,5),(2,2,3,5)): + a1 = ndarray_mod.empty(shape,dt) + a2 = ndarray_mod.c_empty(shape,dt) + self.assertEqual(shape,a1.shape) + self.assertEqual(shape,a2.shape) - def testTranspose(self): - for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): - dt = numpy.dtype(dtp) - for shape in ((6,10),(4,3,5),(2,2,3,5)): - a1 = numpy.empty(shape,dt) - a2 = a1.transpose() - a1 = ndarray_mod.transpose(a1) - self.assertEqual(a1.shape,a2.shape) + def testTranspose(self): + for dtp in (numpy.int16, numpy.int32, numpy.float32, numpy.complex128): + dt = numpy.dtype(dtp) + for shape in ((6,10),(4,3,5),(2,2,3,5)): + a1 = numpy.empty(shape,dt) + a2 = a1.transpose() + a1 = ndarray_mod.transpose(a1) + self.assertEqual(a1.shape,a2.shape) - def testSqueeze(self): - a1 = numpy.array([[[3,4,5]]]) - a2 = a1.squeeze() - a1 = ndarray_mod.squeeze(a1) - self.assertEqual(a1.shape,a2.shape) + def testSqueeze(self): + a1 = numpy.array([[[3,4,5]]]) + a2 = a1.squeeze() + a1 = ndarray_mod.squeeze(a1) + self.assertEqual(a1.shape,a2.shape) - def testReshape(self): - a1 = numpy.empty((2,2)) - a2 = ndarray_mod.reshape(a1,(1,4)) - self.assertEqual(a2.shape,(1,4)) + def testReshape(self): + a1 = numpy.empty((2,2)) + a2 = ndarray_mod.reshape(a1,(1,4)) + self.assertEqual(a2.shape,(1,4)) if __name__=="__main__": - unittest.main() + unittest.main() diff --git a/libs/numpy/test/shapes.py b/libs/numpy/test/shapes.py index 2b46eab0..421aca99 100644 --- a/libs/numpy/test/shapes.py +++ b/libs/numpy/test/shapes.py @@ -5,12 +5,12 @@ import unittest import numpy class TestShapes(unittest.TestCase): - - def testShapes(self): - a1 = numpy.array([(0,1),(2,3)]) - a1_shape = (1,4) - a1 = shapes_mod.reshape(a1,a1_shape) - self.assertEqual(a1_shape,a1.shape) + + def testShapes(self): + a1 = numpy.array([(0,1),(2,3)]) + a1_shape = (1,4) + a1 = shapes_mod.reshape(a1,a1_shape) + self.assertEqual(a1_shape,a1.shape) if __name__=="__main__": - unittest.main() + unittest.main()