(self)
| 2769 | "Decimal('10')") |
| 2770 | |
| 2771 | def test_quantize(self): |
| 2772 | Decimal = self.decimal.Decimal |
| 2773 | Context = self.decimal.Context |
| 2774 | InvalidOperation = self.decimal.InvalidOperation |
| 2775 | |
| 2776 | c = Context(Emax=99999, Emin=-99999) |
| 2777 | self.assertEqual( |
| 2778 | Decimal('7.335').quantize(Decimal('.01')), |
| 2779 | Decimal('7.34') |
| 2780 | ) |
| 2781 | self.assertEqual( |
| 2782 | Decimal('7.335').quantize(Decimal('.01'), rounding=ROUND_DOWN), |
| 2783 | Decimal('7.33') |
| 2784 | ) |
| 2785 | self.assertRaises( |
| 2786 | InvalidOperation, |
| 2787 | Decimal("10e99999").quantize, Decimal('1e100000'), context=c |
| 2788 | ) |
| 2789 | |
| 2790 | c = Context() |
| 2791 | d = Decimal("0.871831e800") |
| 2792 | x = d.quantize(context=c, exp=Decimal("1e797"), rounding=ROUND_DOWN) |
| 2793 | self.assertEqual(x, Decimal('8.71E+799')) |
| 2794 | |
| 2795 | def test_complex(self): |
| 2796 | Decimal = self.decimal.Decimal |
nothing calls this directly
no test coverage detected