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

Method test_badargs

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

Source from the content-addressed store, hash-verified

1002 gradient, f_2d, np.stack([dx]*2, axis=-1), 1)
1003
1004 def test_badargs(self):
1005 f_2d = np.arange(25).reshape(5, 5)
1006 x = np.cumsum(np.ones(5))
1007
1008 # wrong sizes
1009 assert_raises(ValueError, gradient, f_2d, x, np.ones(2))
1010 assert_raises(ValueError, gradient, f_2d, 1, np.ones(2))
1011 assert_raises(ValueError, gradient, f_2d, np.ones(2), np.ones(2))
1012 # wrong number of arguments
1013 assert_raises(TypeError, gradient, f_2d, x)
1014 assert_raises(TypeError, gradient, f_2d, x, axis=(0,1))
1015 assert_raises(TypeError, gradient, f_2d, x, x, x)
1016 assert_raises(TypeError, gradient, f_2d, 1, 1, 1)
1017 assert_raises(TypeError, gradient, f_2d, x, x, axis=1)
1018 assert_raises(TypeError, gradient, f_2d, 1, 1, axis=1)
1019
1020 def test_datetime64(self):
1021 # Make sure gradient() can handle special types like datetime64

Callers

nothing calls this directly

Calls 3

assert_raisesFunction · 0.90
reshapeMethod · 0.80
cumsumMethod · 0.80

Tested by

no test coverage detected