(self)
| 712 | class TestDiff: |
| 713 | |
| 714 | def test_basic(self): |
| 715 | x = [1, 4, 6, 7, 12] |
| 716 | out = np.array([3, 2, 1, 5]) |
| 717 | out2 = np.array([-1, -1, 4]) |
| 718 | out3 = np.array([0, 5]) |
| 719 | assert_array_equal(diff(x), out) |
| 720 | assert_array_equal(diff(x, n=2), out2) |
| 721 | assert_array_equal(diff(x, n=3), out3) |
| 722 | |
| 723 | x = [1.1, 2.2, 3.0, -0.2, -0.1] |
| 724 | out = np.array([1.1, 0.8, -3.2, 0.1]) |
| 725 | assert_almost_equal(diff(x), out) |
| 726 | |
| 727 | x = [True, True, False, False] |
| 728 | out = np.array([False, True, False]) |
| 729 | out2 = np.array([True, True]) |
| 730 | assert_array_equal(diff(x), out) |
| 731 | assert_array_equal(diff(x, n=2), out2) |
| 732 | |
| 733 | def test_axis(self): |
| 734 | x = np.zeros((10, 20, 30)) |
nothing calls this directly
no test coverage detected