(self)
| 2702 | self.assertIs(int(Decimal(x)), x) |
| 2703 | |
| 2704 | def test_trunc(self): |
| 2705 | Decimal = self.decimal.Decimal |
| 2706 | |
| 2707 | for x in range(-250, 250): |
| 2708 | s = '%0.2f' % (x / 100.0) |
| 2709 | # should work the same as for floats |
| 2710 | self.assertEqual(int(Decimal(s)), int(float(s))) |
| 2711 | # should work the same as to_integral in the ROUND_DOWN mode |
| 2712 | d = Decimal(s) |
| 2713 | r = d.to_integral(ROUND_DOWN) |
| 2714 | self.assertEqual(Decimal(math.trunc(d)), r) |
| 2715 | |
| 2716 | def test_from_float(self): |
| 2717 |
nothing calls this directly
no test coverage detected