diff options
author | Mark Wiebe <mwiebe@enthought.com> | 2011-07-26 12:14:21 -0500 |
---|---|---|
committer | Mark Wiebe <mwiebe@enthought.com> | 2011-07-26 12:14:21 -0500 |
commit | 9163993794f1bc56c279ab3d90796370d6b579c4 (patch) | |
tree | f5a40b3c0ca60bf9d7a645073e0600e36ccdd60f /numpy/lib/tests | |
parent | 1b62bdfb04e56f75fc61dbbd1f2600a72951b19d (diff) | |
parent | affea42d886e8233fdd6f3c5760708e3a9e9b1b8 (diff) | |
download | numpy-9163993794f1bc56c279ab3d90796370d6b579c4.tar.gz |
Merge branch 'deprecate_array_field_access'
Diffstat (limited to 'numpy/lib/tests')
-rw-r--r-- | numpy/lib/tests/test_index_tricks.py | 2 | ||||
-rw-r--r-- | numpy/lib/tests/test_recfunctions.py | 5 | ||||
-rw-r--r-- | numpy/lib/tests/test_stride_tricks.py | 31 |
3 files changed, 20 insertions, 18 deletions
diff --git a/numpy/lib/tests/test_index_tricks.py b/numpy/lib/tests/test_index_tricks.py index f0190937b..e4c0bde93 100644 --- a/numpy/lib/tests/test_index_tricks.py +++ b/numpy/lib/tests/test_index_tricks.py @@ -48,7 +48,7 @@ class TestRavelUnravelIndex(TestCase): uncoords = coords[0]+5*coords[1] assert_equal(np.ravel_multi_index(coords, shape, order='F'), uncoords) assert_equal(coords, np.unravel_index(uncoords, shape, order='F')) - + coords = np.array([[1,0,1,2,3,4],[1,6,1,3,2,0],[1,3,1,0,9,5]], dtype=dtype) shape = (5,8,10) diff --git a/numpy/lib/tests/test_recfunctions.py b/numpy/lib/tests/test_recfunctions.py index c6befa5f6..0a3f1e3e3 100644 --- a/numpy/lib/tests/test_recfunctions.py +++ b/numpy/lib/tests/test_recfunctions.py @@ -671,9 +671,10 @@ class TestJoinBy2(TestCase): (10, 2, 54, 69, 14, 4), (11, 2, 55, 70, 15, 5), (10, 3, 56, 71, 16, 6), (11, 3, 57, 72, 17, 7), (10, 4, 58, 73, 18, 8), (11, 4, 59, 74, 19, 9)], - dtype=[('k', '<i8'), ('a', '<i8'), ('b1', '<i8'), - ('b2', '<i8'), ('c1', '<i8'), ('c2', '<i8')]) + dtype=[('k', int), ('a', int), ('b1', int), + ('b2', int), ('c1', int), ('c2', int)]) test = join_by(['a','k'], a, b, r1postfix='1', r2postfix='2', jointype='inner') + assert_equal(test.dtype, control.dtype) assert_equal(test, control) diff --git a/numpy/lib/tests/test_stride_tricks.py b/numpy/lib/tests/test_stride_tricks.py index d7cf114f7..814f2d614 100644 --- a/numpy/lib/tests/test_stride_tricks.py +++ b/numpy/lib/tests/test_stride_tricks.py @@ -11,7 +11,7 @@ def assert_shapes_correct(input_shapes, expected_shape): outarrays = broadcast_arrays(*inarrays) outshapes = [a.shape for a in outarrays] expected = [expected_shape] * len(inarrays) - assert_(outshapes == expected) + assert_equal(outshapes, expected) def assert_incompatible_shapes_raise(input_shapes): """ Broadcast a list of arrays with the given (incompatible) input shapes @@ -76,13 +76,13 @@ def test_same_input_shapes(): for shape in data: input_shapes = [shape] # Single input. - yield assert_shapes_correct, input_shapes, shape + assert_shapes_correct(input_shapes, shape) # Double input. input_shapes2 = [shape, shape] - yield assert_shapes_correct, input_shapes2, shape + assert_shapes_correct(input_shapes2, shape) # Triple input. input_shapes3 = [shape, shape, shape] - yield assert_shapes_correct, input_shapes3, shape + assert_shapes_correct(input_shapes3, shape) def test_two_compatible_by_ones_input_shapes(): """ Check that two different input shapes (of the same length but some have @@ -104,9 +104,9 @@ def test_two_compatible_by_ones_input_shapes(): [[(1,1), (0,1)], (0,1)], ] for input_shapes, expected_shape in data: - yield assert_shapes_correct, input_shapes, expected_shape + assert_shapes_correct(input_shapes, expected_shape) # Reverse the input shapes since broadcasting should be symmetric. - yield assert_shapes_correct, input_shapes[::-1], expected_shape + assert_shapes_correct(input_shapes[::-1], expected_shape) def test_two_compatible_by_prepending_ones_input_shapes(): """ Check that two different input shapes (of different lengths) broadcast @@ -135,9 +135,9 @@ def test_two_compatible_by_prepending_ones_input_shapes(): [[(), (0,1)], (0,1)], ] for input_shapes, expected_shape in data: - yield assert_shapes_correct, input_shapes, expected_shape + assert_shapes_correct(input_shapes, expected_shape) # Reverse the input shapes since broadcasting should be symmetric. - yield assert_shapes_correct, input_shapes[::-1], expected_shape + assert_shapes_correct(input_shapes[::-1], expected_shape) def test_incompatible_shapes_raise_valueerror(): """ Check that a ValueError is raised for incompatible shapes. @@ -149,9 +149,9 @@ def test_incompatible_shapes_raise_valueerror(): [(1,3,4), (2,3,3)], ] for input_shapes in data: - yield assert_incompatible_shapes_raise, input_shapes + assert_incompatible_shapes_raise(input_shapes) # Reverse the input shapes since broadcasting should be symmetric. - yield assert_incompatible_shapes_raise, input_shapes[::-1] + assert_incompatible_shapes_raise(input_shapes[::-1]) def test_same_as_ufunc(): """ Check that the data layout is the same as if a ufunc did the operation. @@ -192,16 +192,17 @@ def test_same_as_ufunc(): [[(), (0,1)], (0,1)], ] for input_shapes, expected_shape in data: - yield assert_same_as_ufunc, input_shapes[0], input_shapes[1] + assert_same_as_ufunc(input_shapes[0], input_shapes[1], + "Shapes: %s %s" % (input_shapes[0], input_shapes[1])) # Reverse the input shapes since broadcasting should be symmetric. - yield assert_same_as_ufunc, input_shapes[1], input_shapes[0] + assert_same_as_ufunc(input_shapes[1], input_shapes[0]) # Try them transposed, too. - yield assert_same_as_ufunc, input_shapes[0], input_shapes[1], True + assert_same_as_ufunc(input_shapes[0], input_shapes[1], True) # ... and flipped for non-rank-0 inputs in order to test negative # strides. if () not in input_shapes: - yield assert_same_as_ufunc, input_shapes[0], input_shapes[1], False, True - yield assert_same_as_ufunc, input_shapes[0], input_shapes[1], True, True + assert_same_as_ufunc(input_shapes[0], input_shapes[1], False, True) + assert_same_as_ufunc(input_shapes[0], input_shapes[1], True, True) if __name__ == "__main__": |