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

Method test_simple

numpy/lib/tests/test_function_base.py:2427–2453  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2425class Test_I0:
2426
2427 def test_simple(self):
2428 assert_almost_equal(
2429 i0(0.5),
2430 np.array(1.0634833707413234))
2431
2432 # need at least one test above 8, as the implementation is piecewise
2433 A = np.array([0.49842636, 0.6969809, 0.22011976, 0.0155549, 10.0])
2434 expected = np.array([1.06307822, 1.12518299, 1.01214991, 1.00006049, 2815.71662847])
2435 assert_almost_equal(i0(A), expected)
2436 assert_almost_equal(i0(-A), expected)
2437
2438 B = np.array([[0.827002, 0.99959078],
2439 [0.89694769, 0.39298162],
2440 [0.37954418, 0.05206293],
2441 [0.36465447, 0.72446427],
2442 [0.48164949, 0.50324519]])
2443 assert_almost_equal(
2444 i0(B),
2445 np.array([[1.17843223, 1.26583466],
2446 [1.21147086, 1.03898290],
2447 [1.03633899, 1.00067775],
2448 [1.03352052, 1.13557954],
2449 [1.05884290, 1.06432317]]))
2450 # Regression test for gh-11205
2451 i0_0 = np.i0([0.])
2452 assert_equal(i0_0.shape, (1,))
2453 assert_array_equal(np.i0([0.]), np.array([1.]))
2454
2455 def test_non_array(self):
2456 a = np.arange(4)

Callers

nothing calls this directly

Calls 4

assert_almost_equalFunction · 0.90
i0Function · 0.90
assert_equalFunction · 0.90
assert_array_equalFunction · 0.90

Tested by

no test coverage detected