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

Method test_nd

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

Source from the content-addressed store, hash-verified

747 assert_raises(ValueError, diff, x)
748
749 def test_nd(self):
750 x = 20 * rand(10, 20, 30)
751 out1 = x[:, :, 1:] - x[:, :, :-1]
752 out2 = out1[:, :, 1:] - out1[:, :, :-1]
753 out3 = x[1:, :, :] - x[:-1, :, :]
754 out4 = out3[1:, :, :] - out3[:-1, :, :]
755 assert_array_equal(diff(x), out1)
756 assert_array_equal(diff(x, n=2), out2)
757 assert_array_equal(diff(x, axis=0), out3)
758 assert_array_equal(diff(x, n=2, axis=0), out4)
759
760 def test_n(self):
761 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