diff options
author | Egor Panfilov <multicolor.mood@gmail.com> | 2017-06-17 15:11:06 +0300 |
---|---|---|
committer | Egor Panfilov <multicolor.mood@gmail.com> | 2017-06-17 19:51:04 +0300 |
commit | 0bf437fb0ae42fefdb0040692b993f17dedb2e3d (patch) | |
tree | b3b42e6a297537cd50dea01757bbc6c58f2f9ad8 /numpy/lib/tests/test_function_base.py | |
parent | 1490ccde8215bc6f4720266259672e34ebcda98f (diff) | |
download | numpy-0bf437fb0ae42fefdb0040692b993f17dedb2e3d.tar.gz |
BUG: Switched to xor for bool arrays in diff, added corresponding tests
Diffstat (limited to 'numpy/lib/tests/test_function_base.py')
-rw-r--r-- | numpy/lib/tests/test_function_base.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/numpy/lib/tests/test_function_base.py b/numpy/lib/tests/test_function_base.py index 7479e30b3..4000b55f5 100644 --- a/numpy/lib/tests/test_function_base.py +++ b/numpy/lib/tests/test_function_base.py @@ -638,6 +638,16 @@ class TestDiff(TestCase): assert_array_equal(diff(x, n=2), out2) assert_array_equal(diff(x, n=3), out3) + x = [1.1, 2.2, 3.0, -0.2, -0.1] + out = np.array([1.1, 0.8, -3.2, 0.1]) + assert_almost_equal(diff(x), out) + + x = [True, True, False, False] + out = np.array([False, True, False]) + out2 = np.array([True, True]) + assert_array_equal(diff(x), out) + assert_array_equal(diff(x, n=2), out2) + def test_nd(self): x = 20 * rand(10, 20, 30) out1 = x[:, :, 1:] - x[:, :, :-1] @@ -927,7 +937,7 @@ class TestGradient(TestCase): assert_raises(ValueError, gradient, np.arange(0), edge_order=2) assert_raises(ValueError, gradient, np.arange(1), edge_order=1) assert_raises(ValueError, gradient, np.arange(1), edge_order=2) - assert_raises(ValueError, gradient, np.arange(2), edge_order=2) + assert_raises(ValueError, gradient, np.arange(2), edge_order=2) class TestAngle(TestCase): |