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

Method test_axis_keyword

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

Source from the content-addressed store, hash-verified

3848 assert_equal(np.median(a).ndim, 0)
3849
3850 def test_axis_keyword(self):
3851 a3 = np.array([[2, 3],
3852 [0, 1],
3853 [6, 7],
3854 [4, 5]])
3855 for a in [a3, np.random.randint(0, 100, size=(2, 3, 4))]:
3856 orig = a.copy()
3857 np.median(a, axis=None)
3858 for ax in range(a.ndim):
3859 np.median(a, axis=ax)
3860 assert_array_equal(a, orig)
3861
3862 assert_allclose(np.median(a3, axis=0), [3, 4])
3863 assert_allclose(np.median(a3.T, axis=1), [3, 4])
3864 assert_allclose(np.median(a3), 3.5)
3865 assert_allclose(np.median(a3, axis=None), 3.5)
3866 assert_allclose(np.median(a3.T), 3.5)
3867
3868 def test_overwrite_keyword(self):
3869 a3 = np.array([[2, 3],

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
assert_allcloseFunction · 0.90
copyMethod · 0.45

Tested by

no test coverage detected