MCPcopy
hub / github.com/numpy/numpy / test_array

Method test_array

numpy/_core/tests/test_umath_complex.py:394–412  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

assert_almost_equalFunction · 0.90

Tested by

no test coverage detected