(self)
| 4190 | raise ex |
| 4191 | |
| 4192 | def test_default_context(self): |
| 4193 | DefaultContext = self.decimal.DefaultContext |
| 4194 | BasicContext = self.decimal.BasicContext |
| 4195 | ExtendedContext = self.decimal.ExtendedContext |
| 4196 | getcontext = self.decimal.getcontext |
| 4197 | setcontext = self.decimal.setcontext |
| 4198 | InvalidOperation = self.decimal.InvalidOperation |
| 4199 | DivisionByZero = self.decimal.DivisionByZero |
| 4200 | Overflow = self.decimal.Overflow |
| 4201 | |
| 4202 | self.assertEqual(BasicContext.prec, 9) |
| 4203 | self.assertEqual(ExtendedContext.prec, 9) |
| 4204 | |
| 4205 | assert_signals(self, DefaultContext, 'traps', |
| 4206 | [InvalidOperation, DivisionByZero, Overflow] |
| 4207 | ) |
| 4208 | |
| 4209 | savecontext = getcontext().copy() |
| 4210 | default_context_prec = DefaultContext.prec |
| 4211 | |
| 4212 | ex = None |
| 4213 | try: |
| 4214 | c = getcontext() |
| 4215 | saveprec = c.prec |
| 4216 | |
| 4217 | DefaultContext.prec = 961 |
| 4218 | c = getcontext() |
| 4219 | self.assertEqual(c.prec, saveprec) |
| 4220 | |
| 4221 | setcontext(DefaultContext) |
| 4222 | c = getcontext() |
| 4223 | self.assertIsNot(c, DefaultContext) |
| 4224 | self.assertEqual(c.prec, 961) |
| 4225 | except Exception as e: |
| 4226 | ex = e.__class__ |
| 4227 | finally: |
| 4228 | DefaultContext.prec = default_context_prec |
| 4229 | setcontext(savecontext) |
| 4230 | if ex: |
| 4231 | raise ex |
| 4232 | |
| 4233 | @requires_cdecimal |
| 4234 | class CSpecialContexts(SpecialContexts, unittest.TestCase): |
nothing calls this directly
no test coverage detected