(self)
| 4626 | self.assertEqual(z, x) |
| 4627 | |
| 4628 | def test_divmod(self): |
| 4629 | Decimal = self.decimal.Decimal |
| 4630 | localcontext = self.decimal.localcontext |
| 4631 | InvalidOperation = self.decimal.InvalidOperation |
| 4632 | DivisionByZero = self.decimal.DivisionByZero |
| 4633 | |
| 4634 | with localcontext() as c: |
| 4635 | q, r = divmod(Decimal("10912837129"), 1001) |
| 4636 | self.assertEqual(q, Decimal('10901935')) |
| 4637 | self.assertEqual(r, Decimal('194')) |
| 4638 | |
| 4639 | q, r = divmod(Decimal("NaN"), 7) |
| 4640 | self.assertTrue(q.is_nan() and r.is_nan()) |
| 4641 | |
| 4642 | c.traps[InvalidOperation] = False |
| 4643 | q, r = divmod(Decimal("NaN"), 7) |
| 4644 | self.assertTrue(q.is_nan() and r.is_nan()) |
| 4645 | |
| 4646 | c.traps[InvalidOperation] = False |
| 4647 | c.clear_flags() |
| 4648 | q, r = divmod(Decimal("inf"), Decimal("inf")) |
| 4649 | self.assertTrue(q.is_nan() and r.is_nan()) |
| 4650 | self.assertTrue(c.flags[InvalidOperation]) |
| 4651 | |
| 4652 | c.clear_flags() |
| 4653 | q, r = divmod(Decimal("inf"), 101) |
| 4654 | self.assertTrue(q.is_infinite() and r.is_nan()) |
| 4655 | self.assertTrue(c.flags[InvalidOperation]) |
| 4656 | |
| 4657 | c.clear_flags() |
| 4658 | q, r = divmod(Decimal(0), 0) |
| 4659 | self.assertTrue(q.is_nan() and r.is_nan()) |
| 4660 | self.assertTrue(c.flags[InvalidOperation]) |
| 4661 | |
| 4662 | c.traps[DivisionByZero] = False |
| 4663 | c.clear_flags() |
| 4664 | q, r = divmod(Decimal(11), 0) |
| 4665 | self.assertTrue(q.is_infinite() and r.is_nan()) |
| 4666 | self.assertTrue(c.flags[InvalidOperation] and |
| 4667 | c.flags[DivisionByZero]) |
| 4668 | |
| 4669 | def test_power(self): |
| 4670 | Decimal = self.decimal.Decimal |
nothing calls this directly
no test coverage detected