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

Method test_power

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

Source from the content-addressed store, hash-verified

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