MCPcopy
hub / github.com/numpy/numpy / test_n

Method test_n

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

Source from the content-addressed store, hash-verified

893 assert_array_equal(diff(x, n=2, axis=0), out4)
894
895 def test_n(self):
896 x = list(range(3))
897 assert_raises(ValueError, diff, x, n=-1)
898 output = [diff(x, n=n) for n in range(1, 5)]
899 expected = [[1, 1], [0], [], []]
900 assert_(diff(x, n=0) is x)
901 for n, (expected_n, output_n) in enumerate(zip(expected, output), start=1):
902 assert_(type(output_n) is np.ndarray)
903 assert_array_equal(output_n, expected_n)
904 assert_equal(output_n.dtype, np.int_)
905 assert_equal(len(output_n), max(0, len(x) - n))
906
907 def test_times(self):
908 x = np.arange('1066-10-13', '1066-10-16', dtype=np.datetime64)

Callers

nothing calls this directly

Calls 6

assert_raisesFunction · 0.90
diffFunction · 0.90
assert_Function · 0.90
assert_array_equalFunction · 0.90
assert_equalFunction · 0.90
maxFunction · 0.50

Tested by

no test coverage detected