(self, actual)
| 201 | ) |
| 202 | |
| 203 | def __eq__(self, actual) -> bool: |
| 204 | import numpy as np |
| 205 | |
| 206 | # self.expected is supposed to always be an array here. |
| 207 | |
| 208 | if not np.isscalar(actual): |
| 209 | try: |
| 210 | actual = np.asarray(actual) |
| 211 | except Exception as e: |
| 212 | raise TypeError(f"cannot compare '{actual}' to numpy.ndarray") from e |
| 213 | |
| 214 | if not np.isscalar(actual) and actual.shape != self.expected.shape: |
| 215 | return False |
| 216 | |
| 217 | return super().__eq__(actual) |
| 218 | |
| 219 | def _yield_comparisons(self, actual): |
| 220 | import numpy as np |