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

Method test_quantize

Lib/test/test_decimal.py:3556–3566  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3554 self.assertEqual(c.power(modulo=5, b=8, a=2), 1)
3555
3556 def test_quantize(self):
3557 Decimal = self.decimal.Decimal
3558 Context = self.decimal.Context
3559
3560 c = Context()
3561 d = c.quantize(Decimal(1), Decimal(2))
3562 self.assertEqual(c.quantize(1, 2), d)
3563 self.assertEqual(c.quantize(Decimal(1), 2), d)
3564 self.assertEqual(c.quantize(1, Decimal(2)), d)
3565 self.assertRaises(TypeError, c.quantize, '1', 2)
3566 self.assertRaises(TypeError, c.quantize, 1, '2')
3567
3568 def test_remainder(self):
3569 Decimal = self.decimal.Decimal

Callers

nothing calls this directly

Calls 5

quantizeMethod · 0.95
DecimalClass · 0.85
ContextClass · 0.70
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected