(self)
| 847 | class TestDiff: |
| 848 | |
| 849 | def test_basic(self): |
| 850 | x = [1, 4, 6, 7, 12] |
| 851 | out = np.array([3, 2, 1, 5]) |
| 852 | out2 = np.array([-1, -1, 4]) |
| 853 | out3 = np.array([0, 5]) |
| 854 | assert_array_equal(diff(x), out) |
| 855 | assert_array_equal(diff(x, n=2), out2) |
| 856 | assert_array_equal(diff(x, n=3), out3) |
| 857 | |
| 858 | x = [1.1, 2.2, 3.0, -0.2, -0.1] |
| 859 | out = np.array([1.1, 0.8, -3.2, 0.1]) |
| 860 | assert_almost_equal(diff(x), out) |
| 861 | |
| 862 | x = [True, True, False, False] |
| 863 | out = np.array([False, True, False]) |
| 864 | out2 = np.array([True, True]) |
| 865 | assert_array_equal(diff(x), out) |
| 866 | assert_array_equal(diff(x, n=2), out2) |
| 867 | |
| 868 | def test_axis(self): |
| 869 | x = np.zeros((10, 20, 30)) |
nothing calls this directly
no test coverage detected