MCPcopy Create free account
hub / github.com/pytest-dev/pytest / __eq__

Method __eq__

src/_pytest/python_api.py:211–225  ·  view source on GitHub ↗
(self, actual)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

__eq__Method · 0.45

Tested by

no test coverage detected