MCPcopy Index your code
hub / github.com/numpy/numpy / test_against_cmath

Method test_against_cmath

numpy/_core/tests/test_umath.py:4516–4536  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4514 )
4515
4516 def test_against_cmath(self):
4517 import cmath
4518
4519 points = [-1 - 1j, -1 + 1j, +1 - 1j, +1 + 1j]
4520 name_map = {'arcsin': 'asin', 'arccos': 'acos', 'arctan': 'atan',
4521 'arcsinh': 'asinh', 'arccosh': 'acosh', 'arctanh': 'atanh'}
4522 atol = 4 * np.finfo(complex).eps
4523 for func in self.funcs:
4524 fname = func.__name__.split('.')[-1]
4525 cname = name_map.get(fname, fname)
4526 try:
4527 cfunc = getattr(cmath, cname)
4528 except AttributeError:
4529 continue
4530 for p in points:
4531 a = complex(func(np.complex128(p)))
4532 b = cfunc(p)
4533 assert_(
4534 abs(a - b) < atol,
4535 f"{fname} {p}: {a}; cmath: {b}"
4536 )
4537
4538 @pytest.mark.xfail(
4539 # manylinux2014 uses glibc2.17

Callers

nothing calls this directly

Calls 4

assert_Function · 0.90
splitMethod · 0.80
funcFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected