(self)
| 1044 | self._assert_func(y, x) |
| 1045 | |
| 1046 | def test_zeroes(self): |
| 1047 | x = np.array([546456., 0, 15.455]) |
| 1048 | y = np.array(87654.) |
| 1049 | |
| 1050 | expected_msg = ('Mismatched elements: 1 / 3 (33.3%)\n' |
| 1051 | 'Mismatch at index:\n' |
| 1052 | ' [0]: 546456.0 (x), 87654.0 (y)\n' |
| 1053 | 'Max absolute difference among violations: 458802.\n' |
| 1054 | 'Max relative difference among violations: 5.23423917') |
| 1055 | with pytest.raises(AssertionError, match=re.escape(expected_msg)): |
| 1056 | self._assert_func(x, y) |
| 1057 | |
| 1058 | expected_msg = ('Mismatched elements: 2 / 3 (66.7%)\n' |
| 1059 | 'Mismatch at indices:\n' |
| 1060 | ' [1]: 87654.0 (x), 0.0 (y)\n' |
| 1061 | ' [2]: 87654.0 (x), 15.455 (y)\n' |
| 1062 | 'Max absolute difference among violations: 87654.\n' |
| 1063 | 'Max relative difference among violations: ' |
| 1064 | '5670.5626011') |
| 1065 | with pytest.raises(AssertionError, match=re.escape(expected_msg)): |
| 1066 | self._assert_func(y, x) |
| 1067 | |
| 1068 | y = 0 |
| 1069 | |
| 1070 | expected_msg = ('Mismatched elements: 3 / 3 (100%)\n' |
| 1071 | 'Mismatch at indices:\n' |
| 1072 | ' [0]: 546456.0 (x), 0 (y)\n' |
| 1073 | ' [1]: 0.0 (x), 0 (y)\n' |
| 1074 | ' [2]: 15.455 (x), 0 (y)\n' |
| 1075 | 'Max absolute difference among violations: 546456.\n' |
| 1076 | 'Max relative difference among violations: inf') |
| 1077 | with pytest.raises(AssertionError, match=re.escape(expected_msg)): |
| 1078 | self._assert_func(x, y) |
| 1079 | |
| 1080 | expected_msg = ('Mismatched elements: 1 / 3 (33.3%)\n' |
| 1081 | 'Mismatch at index:\n' |
| 1082 | ' [1]: 0 (x), 0.0 (y)\n' |
| 1083 | 'Max absolute difference among violations: 0.\n' |
| 1084 | 'Max relative difference among violations: inf') |
| 1085 | with pytest.raises(AssertionError, match=re.escape(expected_msg)): |
| 1086 | self._assert_func(y, x) |
| 1087 | |
| 1088 | def test_nan_noncompare(self): |
| 1089 | anan = np.array(np.nan) |
nothing calls this directly
no test coverage detected