GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — TST: avoid failures for FPE errors/warnings in `abs` on BSDs · numpy/numpy@da44db0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • numpy/core/tests
    • test_multiarray.py
    • test_numeric.py
    • test_umath.py
    • test_umath_complex.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎numpy/core/tests/test_multiarray.py‎

Copy file name to clipboardExpand all lines: numpy/core/tests/test_multiarray.py
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9698,9 +9698,12 @@ def test_ragged_comparison_fails(op):
96989698
def test_npymath_complex(fun, npfun, x, y, test_dtype):
96999699
# Smoketest npymath functions
97009700
z = test_dtype(complex(x, y))
9701-
got = fun(z)
9702-
expected = npfun(z)
9703-
assert_allclose(got, expected)
9701+
with np.errstate(invalid='ignore'):
9702+
# Fallback implementations may emit a warning for +/-inf (see gh-24876):
9703+
# RuntimeWarning: invalid value encountered in absolute
9704+
got = fun(z)
9705+
expected = npfun(z)
9706+
assert_allclose(got, expected)
97049707

97059708

97069709
def test_npymath_real():
Collapse file

‎numpy/core/tests/test_numeric.py‎

Copy file name to clipboardExpand all lines: numpy/core/tests/test_numeric.py
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,11 @@ def assert_op_raises_fpe(self, fpeerr, flop, sc1, sc2):
916916
@pytest.mark.skipif(IS_WASM, reason="no wasm fp exception support")
917917
@pytest.mark.parametrize("typecode", np.typecodes["AllFloat"])
918918
def test_floating_exceptions(self, typecode):
919+
if 'bsd' in sys.platform and typecode in 'gG':
920+
pytest.skip(reason="Fallback implementations for (c)longdouble may "
921+
"not raise FPE errors as expected on BSD OSes, "
922+
"see gh-24876, gh-23379")
923+
919924
# Test basic arithmetic function errors
920925
with np.errstate(all='raise'):
921926
ftype = obj2sctype(typecode)
Collapse file

‎numpy/core/tests/test_umath.py‎

Copy file name to clipboardExpand all lines: numpy/core/tests/test_umath.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,6 +1645,8 @@ def test_sinh(self):
16451645
np.array(1200.0, dtype='d'))
16461646

16471647
@pytest.mark.skipif(IS_WASM, reason="fp errors don't work in wasm")
1648+
@pytest.mark.skipif('bsd' in sys.platform,
1649+
reason="fallback implementation may not raise, see gh-2487")
16481650
def test_cosh(self):
16491651
in_ = [np.nan, -np.nan, np.inf, -np.inf]
16501652
out = [np.nan, np.nan, np.inf, np.inf]
Collapse file

‎numpy/core/tests/test_umath_complex.py‎

Copy file name to clipboardExpand all lines: numpy/core/tests/test_umath_complex.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,8 @@ def test_array(self, stride, astype):
576576
complex(0., 0.),
577577
complex(np.nan, np.nan),
578578
complex(np.nan, np.nan)], dtype=astype)
579-
assert_equal(np.abs(arr[::stride]), abs_true[::stride])
580579
with np.errstate(invalid='ignore'):
580+
assert_equal(np.abs(arr[::stride]), abs_true[::stride])
581581
assert_equal(np.square(arr[::stride]), sq_true[::stride])
582582

583583
class TestComplexAbsoluteAVX:

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.