(self)
| 925 | assert_array_less(*args, **kwargs) |
| 926 | |
| 927 | def test_simple_arrays(self): |
| 928 | x = np.array([1.1, 2.2]) |
| 929 | y = np.array([1.2, 2.3]) |
| 930 | |
| 931 | self._assert_func(x, y) |
| 932 | assert_raises(AssertionError, lambda: self._assert_func(y, x)) |
| 933 | |
| 934 | y = np.array([1.0, 2.3]) |
| 935 | |
| 936 | assert_raises(AssertionError, lambda: self._assert_func(x, y)) |
| 937 | assert_raises(AssertionError, lambda: self._assert_func(y, x)) |
| 938 | |
| 939 | a = np.array([1, 3, 6, 20]) |
| 940 | b = np.array([2, 4, 6, 8]) |
| 941 | |
| 942 | expected_msg = ('Mismatched elements: 2 / 4 (50%)\n' |
| 943 | 'Mismatch at indices:\n' |
| 944 | ' [2]: 6 (x), 6 (y)\n' |
| 945 | ' [3]: 20 (x), 8 (y)\n' |
| 946 | 'Max absolute difference among violations: 12\n' |
| 947 | 'Max relative difference among violations: 1.5') |
| 948 | with pytest.raises(AssertionError, match=re.escape(expected_msg)): |
| 949 | self._assert_func(a, b) |
| 950 | |
| 951 | def test_rank2(self): |
| 952 | x = np.array([[1.1, 2.2], [3.3, 4.4]]) |
nothing calls this directly
no test coverage detected