OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
faces
/
faces
/
lib
/
python3.10
/
site-packages
/
numpy
/
lib
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/26/2024 01:28:19 PM
rwxr-xr-x
📄
__init__.py
0 bytes
10/26/2024 01:28:19 PM
rw-r--r--
📁
__pycache__
-
10/26/2024 01:29:28 PM
rwxr-xr-x
📁
data
-
10/26/2024 01:29:28 PM
rwxr-xr-x
📄
test__datasource.py
10.32 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test__iotools.py
13.42 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test__version.py
1.95 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_arraypad.py
52.99 KB
10/26/2024 01:28:18 PM
rw-r--r--
📄
test_arraysetops.py
35.07 KB
10/26/2024 01:28:18 PM
rw-r--r--
📄
test_arrayterator.py
1.26 KB
10/26/2024 01:28:18 PM
rw-r--r--
📄
test_financial_expired.py
247 bytes
10/26/2024 01:28:18 PM
rw-r--r--
📄
test_format.py
39.9 KB
10/26/2024 01:28:18 PM
rw-r--r--
📄
test_function_base.py
145.84 KB
10/26/2024 01:28:18 PM
rw-r--r--
📄
test_histograms.py
31.69 KB
10/26/2024 01:28:18 PM
rw-r--r--
📄
test_index_tricks.py
19.78 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_io.py
104.28 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_loadtxt.py
37.42 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_mixins.py
6.87 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_nanfunctions.py
45.5 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_packbits.py
17.13 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_polynomial.py
11.13 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_recfunctions.py
40.59 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_regression.py
8.06 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_shape_base.py
26.13 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_stride_tricks.py
22.31 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_twodim_base.py
18.51 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_type_check.py
14.76 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_ufunclike.py
3.2 KB
10/26/2024 01:28:19 PM
rw-r--r--
📄
test_utils.py
4.53 KB
10/26/2024 01:28:19 PM
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))