OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
faces
/
faces
/
lib
/
python3.10
/
site-packages
/
numpy
/
core
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/26/2024 01:29:21 PM
rwxr-xr-x
📄
__init__.py
0 bytes
10/26/2024 01:28:11 PM
rw-r--r--
📁
__pycache__
-
10/26/2024 01:29:24 PM
rwxr-xr-x
📄
_locales.py
2.15 KB
10/26/2024 01:28:11 PM
rw-r--r--
📁
data
-
10/26/2024 01:29:22 PM
rwxr-xr-x
📁
examples
-
10/26/2024 01:30:05 PM
rwxr-xr-x
📄
test__exceptions.py
2.78 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_abc.py
2.17 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_api.py
21.91 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_argparse.py
1.93 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_array_coercion.py
31.51 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_array_interface.py
7.42 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_arraymethod.py
3.49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_arrayprint.py
36.29 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_casting_floatingpoint_errors.py
4.94 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_casting_unittests.py
33.49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_conversion_utils.py
6.41 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_cpu_dispatcher.py
1.49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_cpu_features.py
7 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_custom_dtypes.py
7.5 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_cython.py
3.54 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_datetime.py
112.48 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_defchararray.py
24.03 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_deprecations.py
44.43 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_dlpack.py
3.42 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_dtype.py
70.86 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_einsum.py
49 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_errstate.py
2.17 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_extint128.py
5.51 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_function_base.py
14.07 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_getlimits.py
5.18 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_half.py
23.66 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_hashtable.py
1011 bytes
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_indexerrors.py
5.01 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_indexing.py
53.04 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_item_selection.py
3.5 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_limited_api.py
1.14 KB
10/26/2024 01:28:09 PM
rw-r--r--
📄
test_longdouble.py
12.74 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_machar.py
1.04 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_mem_overlap.py
28.41 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_mem_policy.py
15.57 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_memmap.py
7.31 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_multiarray.py
361.83 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_nditer.py
126.52 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_nep50_promotions.py
6.31 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_numeric.py
134.44 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_numerictypes.py
20.76 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_overrides.py
21.57 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_print.py
6.58 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_protocols.py
1.14 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_records.py
19.79 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_regression.py
89.1 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalar_ctors.py
5.97 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalar_methods.py
7.69 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarbuffer.py
5.46 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarinherit.py
2.32 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarmath.py
41.81 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_scalarprint.py
18.26 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_shape_base.py
28.97 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_simd.py
42.6 KB
10/26/2024 01:28:10 PM
rw-r--r--
📄
test_simd_module.py
3.72 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_strings.py
3.75 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_ufunc.py
113.7 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_umath.py
168.45 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_umath_accuracy.py
3.81 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_umath_complex.py
22.7 KB
10/26/2024 01:28:11 PM
rw-r--r--
📄
test_unicode.py
12.35 KB
10/26/2024 01:28:11 PM
rw-r--r--
Editing: test__exceptions.py
Close
""" Tests of the ._exceptions module. Primarily for exercising the __str__ methods. """ import pickle import pytest import numpy as np _ArrayMemoryError = np.core._exceptions._ArrayMemoryError _UFuncNoLoopError = np.core._exceptions._UFuncNoLoopError class TestArrayMemoryError: def test_pickling(self): """ Test that _ArrayMemoryError can be pickled """ error = _ArrayMemoryError((1023,), np.dtype(np.uint8)) res = pickle.loads(pickle.dumps(error)) assert res._total_size == error._total_size def test_str(self): e = _ArrayMemoryError((1023,), np.dtype(np.uint8)) str(e) # not crashing is enough # testing these properties is easier than testing the full string repr def test__size_to_string(self): """ Test e._size_to_string """ f = _ArrayMemoryError._size_to_string Ki = 1024 assert f(0) == '0 bytes' assert f(1) == '1 bytes' assert f(1023) == '1023 bytes' assert f(Ki) == '1.00 KiB' assert f(Ki+1) == '1.00 KiB' assert f(10*Ki) == '10.0 KiB' assert f(int(999.4*Ki)) == '999. KiB' assert f(int(1023.4*Ki)) == '1023. KiB' assert f(int(1023.5*Ki)) == '1.00 MiB' assert f(Ki*Ki) == '1.00 MiB' # 1023.9999 Mib should round to 1 GiB assert f(int(Ki*Ki*Ki*0.9999)) == '1.00 GiB' assert f(Ki*Ki*Ki*Ki*Ki*Ki) == '1.00 EiB' # larger than sys.maxsize, adding larger prefixes isn't going to help # anyway. assert f(Ki*Ki*Ki*Ki*Ki*Ki*123456) == '123456. EiB' def test__total_size(self): """ Test e._total_size """ e = _ArrayMemoryError((1,), np.dtype(np.uint8)) assert e._total_size == 1 e = _ArrayMemoryError((2, 4), np.dtype((np.uint64, 16))) assert e._total_size == 1024 class TestUFuncNoLoopError: def test_pickling(self): """ Test that _UFuncNoLoopError can be pickled """ assert isinstance(pickle.dumps(_UFuncNoLoopError), bytes) @pytest.mark.parametrize("args", [ (2, 1, None), (2, 1, "test_prefix"), ("test message",), ]) class TestAxisError: def test_attr(self, args): """Validate attribute types.""" exc = np.AxisError(*args) if len(args) == 1: assert exc.axis is None assert exc.ndim is None else: axis, ndim, *_ = args assert exc.axis == axis assert exc.ndim == ndim def test_pickling(self, args): """Test that `AxisError` can be pickled.""" exc = np.AxisError(*args) exc2 = pickle.loads(pickle.dumps(exc)) assert type(exc) is type(exc2) for name in ("axis", "ndim", "args"): attr1 = getattr(exc, name) attr2 = getattr(exc2, name) assert attr1 == attr2, name