MCPcopy Create free account
hub / github.com/numpy/numpy / test_fabs

Method test_fabs

numpy/core/tests/test_umath_complex.py:422–434  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

420 assert_almost_equal(y, y_r)
421
422 def test_fabs(self):
423 # Test that np.abs(x +- 0j) == np.abs(x) (as mandated by C99 for cabs)
424 x = np.array([1+0j], dtype=complex)
425 assert_array_equal(np.abs(x), np.real(x))
426
427 x = np.array([complex(1, np.NZERO)], dtype=complex)
428 assert_array_equal(np.abs(x), np.real(x))
429
430 x = np.array([complex(np.inf, np.NZERO)], dtype=complex)
431 assert_array_equal(np.abs(x), np.real(x))
432
433 x = np.array([complex(np.nan, np.NZERO)], dtype=complex)
434 assert_array_equal(np.abs(x), np.real(x))
435
436 def test_cabs_inf_nan(self):
437 x, y = [], []

Callers

nothing calls this directly

Calls 2

assert_array_equalFunction · 0.90
realMethod · 0.80

Tested by

no test coverage detected