()
| 114 | assert_equal(list(i), a) |
| 115 | |
| 116 | def test_iter_c_order(): |
| 117 | # Test forcing C order |
| 118 | |
| 119 | # Test the ordering for 1-D to 5-D shapes |
| 120 | for shape in [(5,), (3, 4), (2, 3, 4), (2, 3, 4, 3), (2, 3, 2, 2, 3)]: |
| 121 | a = arange(np.prod(shape)) |
| 122 | # Test each combination of positive and negative strides |
| 123 | for dirs in range(2**len(shape)): |
| 124 | dirs_index = [slice(None)] * len(shape) |
| 125 | for bit in range(len(shape)): |
| 126 | if ((2**bit) & dirs): |
| 127 | dirs_index[bit] = slice(None, None, -1) |
| 128 | dirs_index = tuple(dirs_index) |
| 129 | |
| 130 | aview = a.reshape(shape)[dirs_index] |
| 131 | # C-order |
| 132 | i = nditer(aview, order='C') |
| 133 | assert_equal(list(i), aview.ravel(order='C')) |
| 134 | # Fortran-order |
| 135 | i = nditer(aview.T, order='C') |
| 136 | assert_equal(list(i), aview.T.ravel(order='C')) |
| 137 | # Other order |
| 138 | if len(shape) > 2: |
| 139 | i = nditer(aview.swapaxes(0, 1), order='C') |
| 140 | assert_equal(list(i), |
| 141 | aview.swapaxes(0, 1).ravel(order='C')) |
| 142 | |
| 143 | def test_iter_f_order(): |
| 144 | # Test forcing F order |
nothing calls this directly
no test coverage detected
searching dependent graphs…