(self)
| 949 | self._assert_func(a, b) |
| 950 | |
| 951 | def test_rank2(self): |
| 952 | x = np.array([[1.1, 2.2], [3.3, 4.4]]) |
| 953 | y = np.array([[1.2, 2.3], [3.4, 4.5]]) |
| 954 | |
| 955 | self._assert_func(x, y) |
| 956 | expected_msg = ('Mismatched elements: 4 / 4 (100%)\n' |
| 957 | 'Mismatch at indices:\n' |
| 958 | ' [0, 0]: 1.2 (x), 1.1 (y)\n' |
| 959 | ' [0, 1]: 2.3 (x), 2.2 (y)\n' |
| 960 | ' [1, 0]: 3.4 (x), 3.3 (y)\n' |
| 961 | ' [1, 1]: 4.5 (x), 4.4 (y)\n' |
| 962 | 'Max absolute difference among violations: 0.1\n' |
| 963 | 'Max relative difference among violations: 0.09090909') |
| 964 | with pytest.raises(AssertionError, match=re.escape(expected_msg)): |
| 965 | self._assert_func(y, x) |
| 966 | |
| 967 | y = np.array([[1.0, 2.3], [3.4, 4.5]]) |
| 968 | assert_raises(AssertionError, lambda: self._assert_func(x, y)) |
| 969 | assert_raises(AssertionError, lambda: self._assert_func(y, x)) |
| 970 | |
| 971 | def test_rank3(self): |
| 972 | x = np.ones(shape=(2, 2, 2)) |
nothing calls this directly
no test coverage detected