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

Method test_ints

Lib/test/test_descr.py:248–264  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

246 self.unop_test(a, res, expr, name)
247
248 def test_ints(self):
249 # Testing int operations...
250 self.number_operators(100, 3)
251 # The following crashes in Python 2.2
252 self.assertEqual((1).__bool__(), 1)
253 self.assertEqual((0).__bool__(), 0)
254 # This returns 'NotImplemented' in Python 2.2
255 class C(int):
256 def __add__(self, other):
257 return NotImplemented
258 self.assertEqual(C(5), 5)
259 try:
260 C() + ""
261 except TypeError:
262 pass
263 else:
264 self.fail("NotImplemented should have caused TypeError")
265
266 def test_floats(self):
267 # Testing float operations...

Callers

nothing calls this directly

Calls 5

number_operatorsMethod · 0.95
CClass · 0.70
assertEqualMethod · 0.45
__bool__Method · 0.45
failMethod · 0.45

Tested by

no test coverage detected