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

Method test_add

Lib/test/test_binop.py:251–256  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

249 self.fail("Rat(1, %r) didn't raise TypeError" % bad)
250
251 def test_add(self):
252 self.assertEqual(Rat(2, 3) + Rat(1, 3), 1)
253 self.assertEqual(Rat(2, 3) + 1, Rat(5, 3))
254 self.assertEqual(1 + Rat(2, 3), Rat(5, 3))
255 self.assertEqual(1.0 + Rat(1, 2), 1.5)
256 self.assertEqual(Rat(1, 2) + 1.0, 1.5)
257
258 def test_sub(self):
259 self.assertEqual(Rat(7, 2) - Rat(7, 5), Rat(21, 10))

Callers

nothing calls this directly

Calls 2

RatClass · 0.70
assertEqualMethod · 0.45

Tested by

no test coverage detected