MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_richcompare

Method test_richcompare

Lib/test/test_complex.py:221–247  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

219 a // b
220
221 def test_richcompare(self):
222 self.assertIs(complex.__eq__(1+1j, 1<<10000), False)
223 self.assertIs(complex.__lt__(1+1j, None), NotImplemented)
224 self.assertIs(complex.__eq__(1+1j, None), NotImplemented)
225 self.assertIs(complex.__eq__(1+1j, 1+1j), True)
226 self.assertIs(complex.__eq__(1+1j, 2+2j), False)
227 self.assertIs(complex.__ne__(1+1j, 1+1j), False)
228 self.assertIs(complex.__ne__(1+1j, 2+2j), True)
229 for i in range(1, 100):
230 f = i / 100.0
231 self.assertIs(complex.__eq__(f+0j, f), True)
232 self.assertIs(complex.__ne__(f+0j, f), False)
233 self.assertIs(complex.__eq__(complex(f, f), f), False)
234 self.assertIs(complex.__ne__(complex(f, f), f), True)
235 self.assertIs(complex.__lt__(1+1j, 2+2j), NotImplemented)
236 self.assertIs(complex.__le__(1+1j, 2+2j), NotImplemented)
237 self.assertIs(complex.__gt__(1+1j, 2+2j), NotImplemented)
238 self.assertIs(complex.__ge__(1+1j, 2+2j), NotImplemented)
239 self.assertRaises(TypeError, operator.lt, 1+1j, 2+2j)
240 self.assertRaises(TypeError, operator.le, 1+1j, 2+2j)
241 self.assertRaises(TypeError, operator.gt, 1+1j, 2+2j)
242 self.assertRaises(TypeError, operator.ge, 1+1j, 2+2j)
243 self.assertIs(operator.eq(1+1j, 1+1j), True)
244 self.assertIs(operator.eq(1+1j, 2+2j), False)
245 self.assertIs(operator.ne(1+1j, 1+1j), False)
246 self.assertIs(operator.ne(1+1j, 2+2j), True)
247 self.assertIs(operator.eq(1+1j, 2.0), False)
248
249 @unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: True is not False
250 def test_richcompare_boundaries(self):

Callers

nothing calls this directly

Calls 10

neMethod · 0.80
assertIsMethod · 0.45
__eq__Method · 0.45
__lt__Method · 0.45
__ne__Method · 0.45
__le__Method · 0.45
__gt__Method · 0.45
__ge__Method · 0.45
assertRaisesMethod · 0.45
eqMethod · 0.45

Tested by

no test coverage detected