/
usr
/
local
/
lib64
/
python3.6
/
site-packages
/
numpy
/
core
/
tests
/
/usr/local/lib64/python3.6/site-packages/numpy/core/tests
mkdir
upload
Name
Size
Mode
Actions
data/
-
0755
rm
__pycache__/
-
0755
rm
test_abc.py
2328
0644
edit
dl
rm
test_api.py
20806
0644
edit
dl
rm
test_arrayprint.py
34493
0644
edit
dl
rm
test_conversion_utils.py
4981
0644
edit
dl
rm
test_cpu_features.py
6785
0644
edit
dl
rm
test_datetime.py
108192
0644
edit
dl
rm
test_defchararray.py
24381
0644
edit
dl
rm
test_deprecations.py
24187
0644
edit
dl
rm
test_dtype.py
49291
0644
edit
dl
rm
test_einsum.py
45197
0644
edit
dl
rm
test_errstate.py
2066
0644
edit
dl
rm
test_extint128.py
5643
0644
edit
dl
rm
test_function_base.py
13148
0644
edit
dl
rm
test_getlimits.py
4297
0644
edit
dl
rm
test_half.py
23102
0644
edit
dl
rm
test_indexerrors.py
5130
0644
edit
dl
rm
test_indexing.py
49260
0644
edit
dl
rm
test_item_selection.py
3579
0644
edit
dl
rm
test_longdouble.py
13041
0644
edit
dl
rm
test_machar.py
1066
0644
edit
dl
rm
test_memmap.py
7464
0644
edit
dl
rm
test_mem_overlap.py
28855
0644
edit
dl
rm
test_multiarray.py
319797
0644
edit
dl
rm
test_nditer.py
112298
0644
edit
dl
rm
test_numeric.py
124118
0644
edit
dl
rm
test_numerictypes.py
20846
0644
edit
dl
rm
test_overrides.py
14433
0644
edit
dl
rm
test_print.py
6737
0644
edit
dl
rm
test_protocols.py
1168
0644
edit
dl
rm
test_records.py
19694
0644
edit
dl
rm
test_regression.py
88840
0644
edit
dl
rm
test_scalarbuffer.py
4065
0644
edit
dl
rm
test_scalarinherit.py
2127
0644
edit
dl
rm
test_scalarmath.py
28565
0644
edit
dl
rm
test_scalarprint.py
15158
0644
edit
dl
rm
test_scalar_ctors.py
2580
0644
edit
dl
rm
test_scalar_methods.py
4063
0644
edit
dl
rm
test_shape_base.py
24679
0644
edit
dl
rm
test_ufunc.py
83978
0644
edit
dl
rm
test_umath.py
121442
0644
edit
dl
rm
test_umath_accuracy.py
3044
0644
edit
dl
rm
test_umath_complex.py
23145
0644
edit
dl
rm
test_unicode.py
12553
0644
edit
dl
rm
test__exceptions.py
2005
0644
edit
dl
rm
_locales.py
2192
0644
edit
dl
rm
__init__.py
0
0644
edit
dl
rm
Edit:
/usr/local/lib64/python3.6/site-packages/numpy/core/tests/test__exceptions.py
(2005B)
""" Tests of the ._exceptions module. Primarily for exercising the __str__ methods. """ import pickle 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 prefices 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)
Save
cmd:
run