MCPcopy Index your code
hub / github.com/python/cpython / __eq__

Method __eq__

Lib/test/test_binop.py:187–195  ·  view source on GitHub ↗

Compare two Rats for equality.

(self, other)

Source from the content-addressed store, hash-verified

185 return divmod(other, self)[1]
186
187 def __eq__(self, other):
188 """Compare two Rats for equality."""
189 if isint(other):
190 return self.__den == 1 and self.__num == other
191 if isRat(other):
192 return self.__num == other.__num and self.__den == other.__den
193 if isnum(other):
194 return float(self) == other
195 return NotImplemented
196
197class RatTestCase(unittest.TestCase):
198 """Unit tests for Rat class and its support utilities."""

Callers

nothing calls this directly

Calls 3

isintFunction · 0.85
isRatFunction · 0.85
isnumFunction · 0.85

Tested by

no test coverage detected