PATH:
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
numpy
/
core
/
tests
import pytest import sysconfig import numpy as np from numpy.testing import assert_, assert_raises, IS_WASM # The floating point emulation on ARM EABI systems lacking a hardware FPU is # known to be buggy. This is an attempt to identify these hosts. It may not # catch all possible cases, but it catches the known cases of gh-413 and # gh-15562. hosttype = sysconfig.get_config_var('HOST_GNU_TYPE') arm_softfloat = False if hosttype is None else hosttype.endswith('gnueabi') class TestErrstate: @pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm") @pytest.mark.skipif(arm_softfloat, reason='platform/cpu issue with FPU (gh-413,-15562)') def test_invalid(self): with np.errstate(all='raise', under='ignore'): a = -np.arange(3) # This should work with np.errstate(invalid='ignore'): np.sqrt(a) # While this should fail! with assert_raises(FloatingPointError): np.sqrt(a) @pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm") @pytest.mark.skipif(arm_softfloat, reason='platform/cpu issue with FPU (gh-15562)') def test_divide(self): with np.errstate(all='raise', under='ignore'): a = -np.arange(3) # This should work with np.errstate(divide='ignore'): a // 0 # While this should fail! with assert_raises(FloatingPointError): a // 0 # As should this, see gh-15562 with assert_raises(FloatingPointError): a // a def test_errcall(self): def foo(*args): print(args) olderrcall = np.geterrcall() with np.errstate(call=foo): assert_(np.geterrcall() is foo, 'call is not foo') with np.errstate(call=None): assert_(np.geterrcall() is None, 'call is not None') assert_(np.geterrcall() is olderrcall, 'call is not olderrcall') def test_errstate_decorator(self): @np.errstate(all='ignore') def foo(): a = -np.arange(3) a // 0 foo()
[-] test_custom_dtypes.py
[open]
[-] test_array_interface.py
[open]
[-] test_mem_policy.py
[open]
[-] test_dlpack.py
[open]
[-] test_argparse.py
[open]
[-] test_getlimits.py
[open]
[+]
..
[-] test_machar.py
[open]
[-] _locales.py
[open]
[-] test_arraymethod.py
[open]
[-] test_scalarinherit.py
[open]
[-] test_shape_base.py
[open]
[-] test_scalar_ctors.py
[open]
[-] test_half.py
[open]
[-] test_conversion_utils.py
[open]
[+]
__pycache__
[+]
examples
[-] test_numerictypes.py
[open]
[-] test_datetime.py
[open]
[-] test_einsum.py
[open]
[-] test_abc.py
[open]
[-] test_print.py
[open]
[-] test_nep50_promotions.py
[open]
[-] test_indexerrors.py
[open]
[-] test_errstate.py
[open]
[-] test_simd_module.py
[open]
[-] test_umath_complex.py
[open]
[-] test_mem_overlap.py
[open]
[-] test_overrides.py
[open]
[-] test_records.py
[open]
[-] test_umath_accuracy.py
[open]
[-] test_cpu_dispatcher.py
[open]
[-] test_scalarbuffer.py
[open]
[-] test_numeric.py
[open]
[-] test_dtype.py
[open]
[-] test_multiarray.py
[open]
[-] test_extint128.py
[open]
[-] test__exceptions.py
[open]
[-] test_deprecations.py
[open]
[-] test_hashtable.py
[open]
[-] test_ufunc.py
[open]
[-] test_protocols.py
[open]
[-] test_regression.py
[open]
[-] test_casting_floatingpoint_errors.py
[open]
[-] test_item_selection.py
[open]
[-] test_indexing.py
[open]
[-] test_nditer.py
[open]
[-] test_scalar_methods.py
[open]
[+]
data
[-] test_simd.py
[open]
[-] test_arrayprint.py
[open]
[-] test_strings.py
[open]
[-] test_unicode.py
[open]
[-] test_cpu_features.py
[open]
[-] test_casting_unittests.py
[open]
[-] test_cython.py
[open]
[-] test_memmap.py
[open]
[-] __init__.py
[open]
[-] test_defchararray.py
[open]
[-] test_longdouble.py
[open]
[-] test_array_coercion.py
[open]
[-] test_function_base.py
[open]
[-] test_scalarmath.py
[open]
[-] test_api.py
[open]
[-] test_limited_api.py
[open]
[-] test_scalarprint.py
[open]
[-] test_umath.py
[open]