/opt/imh-python/lib/python3.9/site-packages/numpy/lib/tests
NameSizeModeActions
data/-0755rm
__pycache__/-0755rm
test_arraypad.py548300644editdlrm
test_arraysetops.py359120644editdlrm
test_arrayterator.py12910644editdlrm
test_financial_expired.py2470644editdlrm
test_format.py410280644editdlrm
test_function_base.py1577260644editdlrm
test_histograms.py327340644editdlrm
test_index_tricks.py202560644editdlrm
test_io.py1078910644editdlrm
test_loadtxt.py385600644editdlrm
test_mixins.py70300644editdlrm
test_nanfunctions.py476090644editdlrm
test_packbits.py175460644editdlrm
test_polynomial.py113950644editdlrm
test_recfunctions.py440010644editdlrm
test_regression.py82570644editdlrm
test_shape_base.py268170644editdlrm
test_stride_tricks.py228490644editdlrm
test_twodim_base.py188410644editdlrm
test_type_check.py151140644editdlrm
test_ufunclike.py29820644editdlrm
test_utils.py62180644editdlrm
test__datasource.py105710644editdlrm
test__iotools.py137430644editdlrm
test__version.py19990644editdlrm
__init__.py00644editdlrm
Edit: /opt/imh-python/lib/python3.9/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))