OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
numpy
/
lib
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📁
__pycache__
-
10/28/2024 08:45:53 AM
rwxr-xr-x
📁
data
-
10/28/2024 08:45:52 AM
rwxr-xr-x
📄
test__datasource.py
10.16 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test__iotools.py
13.15 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test__version.py
2.08 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
test_arraypad.py
42.68 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_arraysetops.py
15.49 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_arrayterator.py
1.42 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
test_financial.py
6.62 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_format.py
33.49 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_function_base.py
126.81 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_index_tricks.py
13.1 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_io.py
75.59 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_mixins.py
6.7 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_nanfunctions.py
34.07 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_packbits.py
12.63 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
test_polynomial.py
7.03 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_recfunctions.py
30.54 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_regression.py
8.62 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_shape_base.py
19.02 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_stride_tricks.py
14.69 KB
09/17/2017 01:29:38 PM
rw-r--r--
📄
test_twodim_base.py
16.72 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_type_check.py
12.62 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_ufunclike.py
2.96 KB
09/29/2017 05:31:46 PM
rw-r--r--
📄
test_utils.py
1.62 KB
09/17/2017 01:29:38 PM
rw-r--r--
Editing: test_arrayterator.py
Close
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()