OXIESEC PANEL
- Current Dir:
/
/
usr
/
local
/
lib
/
python3.6
/
dist-packages
/
numpy
/
lib
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/28/2024 05:59:26 AM
rwxr-xr-x
📄
__init__.py
0 bytes
10/28/2024 05:59:24 AM
rw-r--r--
📁
__pycache__
-
10/28/2024 05:59:26 AM
rwxr-xr-x
📁
data
-
10/28/2024 05:59:26 AM
rwxr-xr-x
📄
test__datasource.py
10.24 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test__iotools.py
13.42 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test__version.py
1.94 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_arraypad.py
53.01 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_arraysetops.py
23.74 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_arrayterator.py
1.26 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_financial.py
17.89 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_format.py
37.64 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_function_base.py
123.2 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_histograms.py
32.88 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_index_tricks.py
17.89 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_io.py
98.52 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_mixins.py
6.87 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_nanfunctions.py
37.19 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_packbits.py
17.13 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_polynomial.py
9.78 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_recfunctions.py
40.19 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_regression.py
8.06 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_shape_base.py
23.73 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_stride_tricks.py
16.56 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_twodim_base.py
17.93 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_type_check.py
14.76 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_ufunclike.py
3.2 KB
10/28/2024 05:59:24 AM
rw-r--r--
📄
test_utils.py
3.68 KB
10/28/2024 05:59:24 AM
rw-r--r--
Editing: test_arrayterator.py
Close
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))