$18 GRAYBYTE WORDPRESS FILE MANAGER $97

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/alt/python37/lib64/python3.7/site-packages/numpy/core/tests/

HOME
Current File : /opt/alt/python37/lib64/python3.7/site-packages/numpy/core/tests//test_errstate.py
from __future__ import division, absolute_import, print_function

import platform

import numpy as np
from numpy.testing import TestCase, assert_, run_module_suite, dec


class TestErrstate(TestCase):
    @dec.skipif(platform.machine() == "armv5tel", "See gh-413.")
    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!
            try:
                np.sqrt(a)
            except FloatingPointError:
                pass
            else:
                self.fail("Did not raise an invalid error")

    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!
            try:
                a // 0
            except FloatingPointError:
                pass
            else:
                self.fail("Did not raise divide by zero error")

    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')


if __name__ == "__main__":
    run_module_suite()

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
31 Aug 2024 3.40 AM
root / root
0755
__pycache__
--
31 Aug 2024 3.40 AM
root / root
0755
data
--
31 Aug 2024 3.40 AM
root / root
0755
test_abc.py
1.967 KB
25 Apr 2023 2.30 AM
root / root
0644
test_api.py
18.463 KB
25 Apr 2023 2.30 AM
root / root
0644
test_arrayprint.py
9.976 KB
25 Apr 2023 2.30 AM
root / root
0644
test_datetime.py
90.358 KB
25 Apr 2023 2.30 AM
root / root
0644
test_defchararray.py
25.16 KB
25 Apr 2023 2.30 AM
root / root
0644
test_deprecations.py
18.361 KB
25 Apr 2023 2.30 AM
root / root
0644
test_dtype.py
25.588 KB
25 Apr 2023 2.30 AM
root / root
0644
test_einsum.py
38.67 KB
25 Apr 2023 2.30 AM
root / root
0644
test_errstate.py
1.551 KB
25 Apr 2023 2.30 AM
root / root
0644
test_extint128.py
5.639 KB
25 Apr 2023 2.30 AM
root / root
0644
test_function_base.py
11.161 KB
25 Apr 2023 2.30 AM
root / root
0644
test_getlimits.py
4.505 KB
25 Apr 2023 2.30 AM
root / root
0644
test_half.py
18.211 KB
25 Apr 2023 2.30 AM
root / root
0644
test_indexerrors.py
4.822 KB
25 Apr 2023 2.30 AM
root / root
0644
test_indexing.py
46.842 KB
25 Apr 2023 2.30 AM
root / root
0644
test_item_selection.py
3.579 KB
25 Apr 2023 2.30 AM
root / root
0644
test_longdouble.py
5.827 KB
25 Apr 2023 2.30 AM
root / root
0644
test_machar.py
0.99 KB
25 Apr 2023 2.30 AM
root / root
0644
test_mem_overlap.py
28.871 KB
25 Apr 2023 2.30 AM
root / root
0644
test_memmap.py
6.909 KB
25 Apr 2023 2.30 AM
root / root
0644
test_multiarray.py
254.692 KB
25 Apr 2023 2.30 AM
root / root
0644
test_nditer.py
105.745 KB
25 Apr 2023 2.30 AM
root / root
0644
test_numeric.py
98.49 KB
25 Apr 2023 2.30 AM
root / root
0644
test_numerictypes.py
14.268 KB
25 Apr 2023 2.30 AM
root / root
0644
test_print.py
7.899 KB
25 Apr 2023 2.30 AM
root / root
0644
test_records.py
15.269 KB
25 Apr 2023 2.30 AM
root / root
0644
test_regression.py
79.308 KB
25 Apr 2023 2.30 AM
root / root
0644
test_scalarinherit.py
0.753 KB
25 Apr 2023 2.30 AM
root / root
0644
test_scalarmath.py
24.446 KB
25 Apr 2023 2.30 AM
root / root
0644
test_scalarprint.py
0.896 KB
25 Apr 2023 2.30 AM
root / root
0644
test_shape_base.py
18.109 KB
25 Apr 2023 2.30 AM
root / root
0644
test_ufunc.py
53.696 KB
25 Apr 2023 2.30 AM
root / root
0644
test_umath.py
96.47 KB
25 Apr 2023 2.30 AM
root / root
0644
test_umath_complex.py
19.336 KB
25 Apr 2023 2.30 AM
root / root
0644
test_unicode.py
13.904 KB
25 Apr 2023 2.30 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF