(cls)
| 1642 | # The following are two functions used to test threading in the next class |
| 1643 | |
| 1644 | def thfunc1(cls): |
| 1645 | Decimal = cls.decimal.Decimal |
| 1646 | InvalidOperation = cls.decimal.InvalidOperation |
| 1647 | DivisionByZero = cls.decimal.DivisionByZero |
| 1648 | Overflow = cls.decimal.Overflow |
| 1649 | Underflow = cls.decimal.Underflow |
| 1650 | Inexact = cls.decimal.Inexact |
| 1651 | getcontext = cls.decimal.getcontext |
| 1652 | localcontext = cls.decimal.localcontext |
| 1653 | |
| 1654 | d1 = Decimal(1) |
| 1655 | d3 = Decimal(3) |
| 1656 | test1 = d1/d3 |
| 1657 | |
| 1658 | cls.finish1.set() |
| 1659 | cls.synchro.wait() |
| 1660 | |
| 1661 | test2 = d1/d3 |
| 1662 | with localcontext() as c2: |
| 1663 | cls.assertTrue(c2.flags[Inexact]) |
| 1664 | cls.assertRaises(DivisionByZero, c2.divide, d1, 0) |
| 1665 | cls.assertTrue(c2.flags[DivisionByZero]) |
| 1666 | with localcontext() as c3: |
| 1667 | cls.assertTrue(c3.flags[Inexact]) |
| 1668 | cls.assertTrue(c3.flags[DivisionByZero]) |
| 1669 | cls.assertRaises(InvalidOperation, c3.compare, d1, Decimal('sNaN')) |
| 1670 | cls.assertTrue(c3.flags[InvalidOperation]) |
| 1671 | del c3 |
| 1672 | cls.assertFalse(c2.flags[InvalidOperation]) |
| 1673 | del c2 |
| 1674 | |
| 1675 | cls.assertEqual(test1, Decimal('0.333333333333333333333333')) |
| 1676 | cls.assertEqual(test2, Decimal('0.333333333333333333333333')) |
| 1677 | |
| 1678 | c1 = getcontext() |
| 1679 | cls.assertTrue(c1.flags[Inexact]) |
| 1680 | for sig in Overflow, Underflow, DivisionByZero, InvalidOperation: |
| 1681 | cls.assertFalse(c1.flags[sig]) |
| 1682 | |
| 1683 | def thfunc2(cls): |
| 1684 | Decimal = cls.decimal.Decimal |
nothing calls this directly
no test coverage detected