"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "numpy/core/tests/test_nditer.py" between
numpy-1.21.0.tar.gz and numpy-1.21.1.tar.gz

About: NumPy is the fundamental package for scientific computing with Python.

test_nditer.py  (numpy-1.21.0):test_nditer.py  (numpy-1.21.1)
skipping to change at line 187 skipping to change at line 187
assert_equal([x for x in i], aview.ravel(order='A')) assert_equal([x for x in i], aview.ravel(order='A'))
# Fortran-order # Fortran-order
i = nditer(aview.T, order='A') i = nditer(aview.T, order='A')
assert_equal([x for x in i], aview.T.ravel(order='A')) assert_equal([x for x in i], aview.T.ravel(order='A'))
# Other order # Other order
if len(shape) > 2: if len(shape) > 2:
i = nditer(aview.swapaxes(0, 1), order='A') i = nditer(aview.swapaxes(0, 1), order='A')
assert_equal([x for x in i], assert_equal([x for x in i],
aview.swapaxes(0, 1).ravel(order='A')) aview.swapaxes(0, 1).ravel(order='A'))
def test_nditer_multi_index_set():
# Test the multi_index set
a = np.arange(6).reshape(2, 3)
it = np.nditer(a, flags=['multi_index'])
# Removes the iteration on two first elements of a[0]
it.multi_index = (0, 2,)
assert_equal([i for i in it], [2, 3, 4, 5])
@pytest.mark.skipif(not HAS_REFCOUNT, reason="Python lacks refcounts")
def test_nditer_multi_index_set_refcount():
# Test if the reference count on index variable is decreased
index = 0
i = np.nditer(np.array([111, 222, 333, 444]), flags=['multi_index'])
start_count = sys.getrefcount(index)
i.multi_index = (index,)
end_count = sys.getrefcount(index)
assert_equal(start_count, end_count)
def test_iter_best_order_multi_index_1d(): def test_iter_best_order_multi_index_1d():
# The multi-indices should be correct with any reordering # The multi-indices should be correct with any reordering
a = arange(4) a = arange(4)
# 1D order # 1D order
i = nditer(a, ['multi_index'], [['readonly']]) i = nditer(a, ['multi_index'], [['readonly']])
assert_equal(iter_multi_index(i), [(0,), (1,), (2,), (3,)]) assert_equal(iter_multi_index(i), [(0,), (1,), (2,), (3,)])
# 1D reversed order # 1D reversed order
i = nditer(a[::-1], ['multi_index'], [['readonly']]) i = nditer(a[::-1], ['multi_index'], [['readonly']])
assert_equal(iter_multi_index(i), [(3,), (2,), (1,), (0,)]) assert_equal(iter_multi_index(i), [(3,), (2,), (1,), (0,)])
 End of changes. 1 change blocks. 
0 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)