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

Method test_nd

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

Source from the content-addressed store, hash-verified

882 assert_raises(ValueError, diff, x)
883
884 def test_nd(self):
885 x = 20 * rand(10, 20, 30)
886 out1 = x[:, :, 1:] - x[:, :, :-1]
887 out2 = out1[:, :, 1:] - out1[:, :, :-1]
888 out3 = x[1:, :, :] - x[:-1, :, :]
889 out4 = out3[1:, :, :] - out3[:-1, :, :]
890 assert_array_equal(diff(x), out1)
891 assert_array_equal(diff(x, n=2), out2)
892 assert_array_equal(diff(x, axis=0), out3)
893 assert_array_equal(diff(x, n=2, axis=0), out4)
894
895 def test_n(self):
896 x = list(range(3))

Callers

nothing calls this directly

Calls 3

assert_array_equalFunction · 0.90
diffFunction · 0.90
randFunction · 0.85

Tested by

no test coverage detected