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