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