Hackfut Security File Manager
Current Path:
/opt/alt/python37/lib64/python3.7/site-packages/numpy/lib/tests
opt
/
alt
/
python37
/
lib64
/
python3.7
/
site-packages
/
numpy
/
lib
/
tests
/
📁
..
📁
__pycache__
📁
data
📄
test__datasource.py
(10.16 KB)
📄
test__iotools.py
(13.15 KB)
📄
test__version.py
(2.08 KB)
📄
test_arraypad.py
(42.68 KB)
📄
test_arraysetops.py
(15.49 KB)
📄
test_arrayterator.py
(1.42 KB)
📄
test_financial.py
(6.62 KB)
📄
test_format.py
(33.49 KB)
📄
test_function_base.py
(126.81 KB)
📄
test_index_tricks.py
(13.1 KB)
📄
test_io.py
(75.59 KB)
📄
test_mixins.py
(6.7 KB)
📄
test_nanfunctions.py
(34.07 KB)
📄
test_packbits.py
(12.63 KB)
📄
test_polynomial.py
(7.03 KB)
📄
test_recfunctions.py
(30.54 KB)
📄
test_regression.py
(8.62 KB)
📄
test_shape_base.py
(19.02 KB)
📄
test_stride_tricks.py
(14.69 KB)
📄
test_twodim_base.py
(16.72 KB)
📄
test_type_check.py
(12.62 KB)
📄
test_ufunclike.py
(2.96 KB)
📄
test_utils.py
(1.62 KB)
Editing: test_arrayterator.py
from __future__ import division, absolute_import, print_function 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)) if __name__ == '__main__': from numpy.testing import run_module_suite run_module_suite()
Upload File
Create Folder