MCPcopy Create free account
hub / github.com/numpy/numpy / test_rotation_axes

Method test_rotation_axes

numpy/lib/tests/test_function_base.py:87–113  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

85 assert_equal(rot90(a, axes=(1,2)), rot90(a, axes=(-2,-1)))
86
87 def test_rotation_axes(self):
88 a = np.arange(8).reshape((2,2,2))
89
90 a_rot90_01 = [[[2, 3],
91 [6, 7]],
92 [[0, 1],
93 [4, 5]]]
94 a_rot90_12 = [[[1, 3],
95 [0, 2]],
96 [[5, 7],
97 [4, 6]]]
98 a_rot90_20 = [[[4, 0],
99 [6, 2]],
100 [[5, 1],
101 [7, 3]]]
102 a_rot90_10 = [[[4, 5],
103 [0, 1]],
104 [[6, 7],
105 [2, 3]]]
106
107 assert_equal(rot90(a, axes=(0, 1)), a_rot90_01)
108 assert_equal(rot90(a, axes=(1, 0)), a_rot90_10)
109 assert_equal(rot90(a, axes=(1, 2)), a_rot90_12)
110
111 for k in range(1,5):
112 assert_equal(rot90(a, k=k, axes=(2, 0)),
113 rot90(a_rot90_20, k=k-1, axes=(2, 0)))
114
115
116class TestFlip:

Callers

nothing calls this directly

Calls 3

assert_equalFunction · 0.90
rot90Function · 0.90
reshapeMethod · 0.80

Tested by

no test coverage detected