MCPcopy
hub / github.com/numpy/numpy / test_badargs

Method test_badargs

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

Source from the content-addressed store, hash-verified

1143 gradient, f_2d, np.stack([dx] * 2, axis=-1), 1)
1144
1145 def test_badargs(self):
1146 f_2d = np.arange(25).reshape(5, 5)
1147 x = np.cumsum(np.ones(5))
1148
1149 # wrong sizes
1150 assert_raises(ValueError, gradient, f_2d, x, np.ones(2))
1151 assert_raises(ValueError, gradient, f_2d, 1, np.ones(2))
1152 assert_raises(ValueError, gradient, f_2d, np.ones(2), np.ones(2))
1153 # wrong number of arguments
1154 assert_raises(TypeError, gradient, f_2d, x)
1155 assert_raises(TypeError, gradient, f_2d, x, axis=(0, 1))
1156 assert_raises(TypeError, gradient, f_2d, x, x, x)
1157 assert_raises(TypeError, gradient, f_2d, 1, 1, 1)
1158 assert_raises(TypeError, gradient, f_2d, x, x, axis=1)
1159 assert_raises(TypeError, gradient, f_2d, 1, 1, axis=1)
1160
1161 def test_datetime64(self):
1162 # 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