summaryrefslogtreecommitdiff
path: root/numpy/lib/tests/test_stride_tricks.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/tests/test_stride_tricks.py')
-rw-r--r--numpy/lib/tests/test_stride_tricks.py144
1 files changed, 72 insertions, 72 deletions
diff --git a/numpy/lib/tests/test_stride_tricks.py b/numpy/lib/tests/test_stride_tricks.py
index f815b247f..5d06e0a8c 100644
--- a/numpy/lib/tests/test_stride_tricks.py
+++ b/numpy/lib/tests/test_stride_tricks.py
@@ -52,10 +52,10 @@ def test_same():
assert_array_equal(y, by)
def test_one_off():
- x = np.array([[1,2,3]])
- y = np.array([[1],[2],[3]])
+ x = np.array([[1, 2, 3]])
+ y = np.array([[1], [2], [3]])
bx, by = broadcast_arrays(x, y)
- bx0 = np.array([[1,2,3],[1,2,3],[1,2,3]])
+ bx0 = np.array([[1, 2, 3], [1, 2, 3], [1, 2, 3]])
by0 = bx0.T
assert_array_equal(bx0, bx)
assert_array_equal(by0, by)
@@ -67,13 +67,13 @@ def test_same_input_shapes():
(),
(1,),
(3,),
- (0,1),
- (0,3),
- (1,0),
- (3,0),
- (1,3),
- (3,1),
- (3,3),
+ (0, 1),
+ (0, 3),
+ (1, 0),
+ (3, 0),
+ (1, 3),
+ (3, 1),
+ (3, 3),
]
for shape in data:
input_shapes = [shape]
@@ -92,18 +92,18 @@ def test_two_compatible_by_ones_input_shapes():
"""
data = [
[[(1,), (3,)], (3,)],
- [[(1,3), (3,3)], (3,3)],
- [[(3,1), (3,3)], (3,3)],
- [[(1,3), (3,1)], (3,3)],
- [[(1,1), (3,3)], (3,3)],
- [[(1,1), (1,3)], (1,3)],
- [[(1,1), (3,1)], (3,1)],
- [[(1,0), (0,0)], (0,0)],
- [[(0,1), (0,0)], (0,0)],
- [[(1,0), (0,1)], (0,0)],
- [[(1,1), (0,0)], (0,0)],
- [[(1,1), (1,0)], (1,0)],
- [[(1,1), (0,1)], (0,1)],
+ [[(1, 3), (3, 3)], (3, 3)],
+ [[(3, 1), (3, 3)], (3, 3)],
+ [[(1, 3), (3, 1)], (3, 3)],
+ [[(1, 1), (3, 3)], (3, 3)],
+ [[(1, 1), (1, 3)], (1, 3)],
+ [[(1, 1), (3, 1)], (3, 1)],
+ [[(1, 0), (0, 0)], (0, 0)],
+ [[(0, 1), (0, 0)], (0, 0)],
+ [[(1, 0), (0, 1)], (0, 0)],
+ [[(1, 1), (0, 0)], (0, 0)],
+ [[(1, 1), (1, 0)], (1, 0)],
+ [[(1, 1), (0, 1)], (0, 1)],
]
for input_shapes, expected_shape in data:
assert_shapes_correct(input_shapes, expected_shape)
@@ -116,25 +116,25 @@ def test_two_compatible_by_prepending_ones_input_shapes():
"""
data = [
[[(), (3,)], (3,)],
- [[(3,), (3,3)], (3,3)],
- [[(3,), (3,1)], (3,3)],
- [[(1,), (3,3)], (3,3)],
- [[(), (3,3)], (3,3)],
- [[(1,1), (3,)], (1,3)],
- [[(1,), (3,1)], (3,1)],
- [[(1,), (1,3)], (1,3)],
- [[(), (1,3)], (1,3)],
- [[(), (3,1)], (3,1)],
+ [[(3,), (3, 3)], (3, 3)],
+ [[(3,), (3, 1)], (3, 3)],
+ [[(1,), (3, 3)], (3, 3)],
+ [[(), (3, 3)], (3, 3)],
+ [[(1, 1), (3,)], (1, 3)],
+ [[(1,), (3, 1)], (3, 1)],
+ [[(1,), (1, 3)], (1, 3)],
+ [[(), (1, 3)], (1, 3)],
+ [[(), (3, 1)], (3, 1)],
[[(), (0,)], (0,)],
- [[(0,), (0,0)], (0,0)],
- [[(0,), (0,1)], (0,0)],
- [[(1,), (0,0)], (0,0)],
- [[(), (0,0)], (0,0)],
- [[(1,1), (0,)], (1,0)],
- [[(1,), (0,1)], (0,1)],
- [[(1,), (1,0)], (1,0)],
- [[(), (1,0)], (1,0)],
- [[(), (0,1)], (0,1)],
+ [[(0,), (0, 0)], (0, 0)],
+ [[(0,), (0, 1)], (0, 0)],
+ [[(1,), (0, 0)], (0, 0)],
+ [[(), (0, 0)], (0, 0)],
+ [[(1, 1), (0,)], (1, 0)],
+ [[(1,), (0, 1)], (0, 1)],
+ [[(1,), (1, 0)], (1, 0)],
+ [[(), (1, 0)], (1, 0)],
+ [[(), (0, 1)], (0, 1)],
]
for input_shapes, expected_shape in data:
assert_shapes_correct(input_shapes, expected_shape)
@@ -146,9 +146,9 @@ def test_incompatible_shapes_raise_valueerror():
"""
data = [
[(3,), (4,)],
- [(2,3), (2,)],
+ [(2, 3), (2,)],
[(3,), (3,), (4,)],
- [(1,3,4), (2,3,3)],
+ [(1, 3, 4), (2, 3, 3)],
]
for input_shapes in data:
assert_incompatible_shapes_raise(input_shapes)
@@ -160,38 +160,38 @@ def test_same_as_ufunc():
"""
data = [
[[(1,), (3,)], (3,)],
- [[(1,3), (3,3)], (3,3)],
- [[(3,1), (3,3)], (3,3)],
- [[(1,3), (3,1)], (3,3)],
- [[(1,1), (3,3)], (3,3)],
- [[(1,1), (1,3)], (1,3)],
- [[(1,1), (3,1)], (3,1)],
- [[(1,0), (0,0)], (0,0)],
- [[(0,1), (0,0)], (0,0)],
- [[(1,0), (0,1)], (0,0)],
- [[(1,1), (0,0)], (0,0)],
- [[(1,1), (1,0)], (1,0)],
- [[(1,1), (0,1)], (0,1)],
+ [[(1, 3), (3, 3)], (3, 3)],
+ [[(3, 1), (3, 3)], (3, 3)],
+ [[(1, 3), (3, 1)], (3, 3)],
+ [[(1, 1), (3, 3)], (3, 3)],
+ [[(1, 1), (1, 3)], (1, 3)],
+ [[(1, 1), (3, 1)], (3, 1)],
+ [[(1, 0), (0, 0)], (0, 0)],
+ [[(0, 1), (0, 0)], (0, 0)],
+ [[(1, 0), (0, 1)], (0, 0)],
+ [[(1, 1), (0, 0)], (0, 0)],
+ [[(1, 1), (1, 0)], (1, 0)],
+ [[(1, 1), (0, 1)], (0, 1)],
[[(), (3,)], (3,)],
- [[(3,), (3,3)], (3,3)],
- [[(3,), (3,1)], (3,3)],
- [[(1,), (3,3)], (3,3)],
- [[(), (3,3)], (3,3)],
- [[(1,1), (3,)], (1,3)],
- [[(1,), (3,1)], (3,1)],
- [[(1,), (1,3)], (1,3)],
- [[(), (1,3)], (1,3)],
- [[(), (3,1)], (3,1)],
+ [[(3,), (3, 3)], (3, 3)],
+ [[(3,), (3, 1)], (3, 3)],
+ [[(1,), (3, 3)], (3, 3)],
+ [[(), (3, 3)], (3, 3)],
+ [[(1, 1), (3,)], (1, 3)],
+ [[(1,), (3, 1)], (3, 1)],
+ [[(1,), (1, 3)], (1, 3)],
+ [[(), (1, 3)], (1, 3)],
+ [[(), (3, 1)], (3, 1)],
[[(), (0,)], (0,)],
- [[(0,), (0,0)], (0,0)],
- [[(0,), (0,1)], (0,0)],
- [[(1,), (0,0)], (0,0)],
- [[(), (0,0)], (0,0)],
- [[(1,1), (0,)], (1,0)],
- [[(1,), (0,1)], (0,1)],
- [[(1,), (1,0)], (1,0)],
- [[(), (1,0)], (1,0)],
- [[(), (0,1)], (0,1)],
+ [[(0,), (0, 0)], (0, 0)],
+ [[(0,), (0, 1)], (0, 0)],
+ [[(1,), (0, 0)], (0, 0)],
+ [[(), (0, 0)], (0, 0)],
+ [[(1, 1), (0,)], (1, 0)],
+ [[(1,), (0, 1)], (0, 1)],
+ [[(1,), (1, 0)], (1, 0)],
+ [[(), (1, 0)], (1, 0)],
+ [[(), (0, 1)], (0, 1)],
]
for input_shapes, expected_shape in data:
assert_same_as_ufunc(input_shapes[0], input_shapes[1],