/opt/imh-python/lib/python3.9/site-packages/numpy/core/tests
NameSizeModeActions
data/-0755rm
examples/-0755rm
__pycache__/-0755rm
test_abc.py22200644editdlrm
test_api.py229950644editdlrm
test_argparse.py19690644editdlrm
test_arraymethod.py32440644editdlrm
test_arrayprint.py404620644editdlrm
test_array_coercion.py343790644editdlrm
test_array_interface.py77740644editdlrm
test_casting_floatingpoint_errors.py50630644editdlrm
test_casting_unittests.py342980644editdlrm
test_conversion_utils.py65590644editdlrm
test_cpu_dispatcher.py15210644editdlrm
test_cpu_features.py148580644editdlrm
test_custom_dtypes.py94010644editdlrm
test_cython.py34440644editdlrm
test_datetime.py1162110644editdlrm
test_defchararray.py249970644editdlrm
test_deprecations.py310760644editdlrm
test_dlpack.py35220644editdlrm
test_dtype.py754510644editdlrm
test_einsum.py537120644editdlrm
test_errstate.py22190644editdlrm
test_extint128.py56430644editdlrm
test_function_base.py155950644editdlrm
test_getlimits.py67180644editdlrm
test_half.py242260644editdlrm
test_hashtable.py10110644editdlrm
test_indexerrors.py51300644editdlrm
test_indexing.py543140644editdlrm
test_item_selection.py64580644editdlrm
test_limited_api.py11720644editdlrm
test_longdouble.py139050644editdlrm
test_machar.py10670644editdlrm
test_memmap.py74770644editdlrm
test_mem_overlap.py290860644editdlrm
test_mem_policy.py167800644editdlrm
test_multiarray.py3798270644editdlrm
test_nditer.py1308180644editdlrm
test_nep50_promotions.py88400644editdlrm
test_numeric.py1365430644editdlrm
test_numerictypes.py216870644editdlrm
test_overrides.py260800644editdlrm
test_print.py68370644editdlrm
test_protocols.py11680644editdlrm
test_records.py202690644editdlrm
test_regression.py915950644editdlrm
test_scalarbuffer.py55800644editdlrm
test_scalarinherit.py23680644editdlrm
test_scalarmath.py432470644editdlrm
test_scalarprint.py187710644editdlrm
test_scalar_ctors.py61150644editdlrm
test_scalar_methods.py75410644editdlrm
test_shape_base.py297230644editdlrm
test_simd.py486960644editdlrm
test_simd_module.py38050644editdlrm
test_strings.py38350644editdlrm
test_ufunc.py1248000644editdlrm
test_umath.py1856010644editdlrm
test_umath_accuracy.py38970644editdlrm
test_umath_complex.py232430644editdlrm
test_unicode.py127750644editdlrm
test__exceptions.py28460644editdlrm
_locales.py22060644editdlrm
__init__.py00644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/numpy/core/tests/test__exceptions.py (2846B)
""" 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