()
| 87 | assert_equal(sys.getrefcount(dt), rc_dt) |
| 88 | |
| 89 | def test_iter_best_order(): |
| 90 | # The iterator should always find the iteration order |
| 91 | # with increasing memory addresses |
| 92 | |
| 93 | # Test the ordering for 1-D to 5-D shapes |
| 94 | for shape in [(5,), (3, 4), (2, 3, 4), (2, 3, 4, 3), (2, 3, 2, 2, 3)]: |
| 95 | a = arange(np.prod(shape)) |
| 96 | # Test each combination of positive and negative strides |
| 97 | for dirs in range(2**len(shape)): |
| 98 | dirs_index = [slice(None)] * len(shape) |
| 99 | for bit in range(len(shape)): |
| 100 | if ((2**bit) & dirs): |
| 101 | dirs_index[bit] = slice(None, None, -1) |
| 102 | dirs_index = tuple(dirs_index) |
| 103 | |
| 104 | aview = a.reshape(shape)[dirs_index] |
| 105 | # C-order |
| 106 | i = nditer(aview, [], [['readonly']]) |
| 107 | assert_equal(list(i), a) |
| 108 | # Fortran-order |
| 109 | i = nditer(aview.T, [], [['readonly']]) |
| 110 | assert_equal(list(i), a) |
| 111 | # Other order |
| 112 | if len(shape) > 2: |
| 113 | i = nditer(aview.swapaxes(0, 1), [], [['readonly']]) |
| 114 | assert_equal(list(i), a) |
| 115 | |
| 116 | def test_iter_c_order(): |
| 117 | # Test forcing C order |
nothing calls this directly
no test coverage detected
searching dependent graphs…