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

Method test_power

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

Source from the content-addressed store, hash-verified

4667 c.flags[DivisionByZero])
4668
4669 def test_power(self):
4670 Decimal = self.decimal.Decimal
4671 localcontext = self.decimal.localcontext
4672 Overflow = self.decimal.Overflow
4673 Rounded = self.decimal.Rounded
4674
4675 with localcontext() as c:
4676 c.prec = 3
4677 c.clear_flags()
4678 self.assertEqual(Decimal("1.0") ** 100, Decimal('1.00'))
4679 self.assertTrue(c.flags[Rounded])
4680
4681 c.prec = 1
4682 c.Emax = 1
4683 c.Emin = -1
4684 c.clear_flags()
4685 c.traps[Overflow] = False
4686 self.assertEqual(Decimal(10000) ** Decimal("0.5"), Decimal('inf'))
4687 self.assertTrue(c.flags[Overflow])
4688
4689 def test_quantize(self):
4690 Decimal = self.decimal.Decimal

Callers

nothing calls this directly

Calls 5

localcontextFunction · 0.85
DecimalClass · 0.85
clear_flagsMethod · 0.80
assertTrueMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected