diff options
author | Alan McIntyre <alan.mcintyre@local> | 2008-07-22 18:18:42 +0000 |
---|---|---|
committer | Alan McIntyre <alan.mcintyre@local> | 2008-07-22 18:18:42 +0000 |
commit | 856861c4e59c945aac844dd172fa9612623e858b (patch) | |
tree | 6a9b45a449e0a5f7e1681e3bffd19bd701910b93 /numpy/lib/tests/test_function_base.py | |
parent | b5e26c40f2766890b600bd8b68eb01b4ec9f902b (diff) | |
download | numpy-856861c4e59c945aac844dd172fa9612623e858b.tar.gz |
Added tests to improve coverage of numpy.lib.
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index cab212a9a..3cc607f93 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -287,6 +287,19 @@ class TestDiff(TestCase): assert_array_equal(diff(x,axis=0),out3) assert_array_equal(diff(x,n=2,axis=0),out4) +class TestGradient(TestCase): + def test_basic(self): + x = array([[1,1],[3,4]]) + dx = [array([[2.,3.],[2.,3.]]), + array([[0.,0.],[1.,1.]])] + assert_array_equal(gradient(x), dx) + + def test_badargs(self): + # for 2D array, gradient can take 0,1, or 2 extra args + x = array([[1,1],[3,4]]) + assert_raises(SyntaxError, gradient, x, array([1.,1.]), + array([1.,1.]), array([1.,1.])) + class TestAngle(TestCase): def test_basic(self): x = [1+3j,sqrt(2)/2.0+1j*sqrt(2)/2,1,1j,-1,-1j,1-3j,-1+3j] |