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