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

Method test_array

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

Source from the content-addressed store, hash-verified

387 assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
388
389 def test_array(self):
390 x = np.array([1, 1j, 2, 2.5+.37j, np.inf, np.nan])
391 y = np.array([1, 1j, -0.5+1.5j, -0.5+1.5j, 2, 3])
392 lx = list(range(len(x)))
393
394 # Hardcode the expected `builtins.complex` values,
395 # as complex exponentiation is broken as of bpo-44698
396 p_r = [
397 1+0j,
398 0.20787957635076193+0j,
399 0.35812203996480685+0.6097119028618724j,
400 0.12659112128185032+0.48847676699581527j,
401 complex(np.inf, np.nan),
402 complex(np.nan, np.nan),
403 ]
404
405 n_r = x ** y
406 for i in lx:
407 assert_almost_equal(n_r[i], p_r[i], err_msg='Loop %d\n' % i)
408
409class TestCabs:
410 def setup_method(self):

Callers

nothing calls this directly

Calls 1

assert_almost_equalFunction · 0.90

Tested by

no test coverage detected