/usr/local/lib64/python3.6/site-packages/numpy/lib/tests
NameSizeModeActions
data/-0755rm
__pycache__/-0755rm
test_arraypad.py542830644editdlrm
test_arraysetops.py243080644editdlrm
test_arrayterator.py12910644editdlrm
test_financial.py183160644editdlrm
test_format.py385440644editdlrm
test_function_base.py1261520644editdlrm
test_histograms.py336720644editdlrm
test_index_tricks.py183240644editdlrm
test_io.py1008880644editdlrm
test_mixins.py70300644editdlrm
test_nanfunctions.py380850644editdlrm
test_packbits.py175460644editdlrm
test_polynomial.py100130644editdlrm
test_recfunctions.py411550644editdlrm
test_regression.py82570644editdlrm
test_shape_base.py243030644editdlrm
test_stride_tricks.py169540644editdlrm
test_twodim_base.py183580644editdlrm
test_type_check.py151190644editdlrm
test_ufunclike.py32780644editdlrm
test_utils.py37690644editdlrm
test__datasource.py104870644editdlrm
test__iotools.py137430644editdlrm
test__version.py19890644editdlrm
__init__.py00644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/numpy/lib/tests/test_arrayterator.py (1291B)
from operator import mul from functools import reduce import numpy as np from numpy.random import randint from numpy.lib import Arrayterator from numpy.testing import assert_ def test(): np.random.seed(np.arange(10)) # Create a random array ndims = randint(5)+1 shape = tuple(randint(10)+1 for dim in range(ndims)) els = reduce(mul, shape) a = np.arange(els) a.shape = shape buf_size = randint(2*els) b = Arrayterator(a, buf_size) # Check that each block has at most ``buf_size`` elements for block in b: assert_(len(block.flat) <= (buf_size or els)) # Check that all elements are iterated correctly assert_(list(b.flat) == list(a.flat)) # Slice arrayterator start = [randint(dim) for dim in shape] stop = [randint(dim)+1 for dim in shape] step = [randint(dim)+1 for dim in shape] slice_ = tuple(slice(*t) for t in zip(start, stop, step)) c = b[slice_] d = a[slice_] # Check that each block has at most ``buf_size`` elements for block in c: assert_(len(block.flat) <= (buf_size or els)) # Check that the arrayterator is sliced correctly assert_(np.all(c.__array__() == d)) # Check that all elements are iterated correctly assert_(list(c.flat) == list(d.flat))