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