(self)
| 2309 | str(c.sqrt(Decimal(0)))) |
| 2310 | |
| 2311 | def test_none_args(self): |
| 2312 | Decimal = self.decimal.Decimal |
| 2313 | Context = self.decimal.Context |
| 2314 | localcontext = self.decimal.localcontext |
| 2315 | InvalidOperation = self.decimal.InvalidOperation |
| 2316 | DivisionByZero = self.decimal.DivisionByZero |
| 2317 | Overflow = self.decimal.Overflow |
| 2318 | Underflow = self.decimal.Underflow |
| 2319 | Subnormal = self.decimal.Subnormal |
| 2320 | Inexact = self.decimal.Inexact |
| 2321 | Rounded = self.decimal.Rounded |
| 2322 | Clamped = self.decimal.Clamped |
| 2323 | |
| 2324 | with localcontext(Context()) as c: |
| 2325 | c.prec = 7 |
| 2326 | c.Emax = 999 |
| 2327 | c.Emin = -999 |
| 2328 | |
| 2329 | x = Decimal("111") |
| 2330 | y = Decimal("1e9999") |
| 2331 | z = Decimal("1e-9999") |
| 2332 | |
| 2333 | ##### Unary functions |
| 2334 | c.clear_flags() |
| 2335 | self.assertEqual(str(x.exp(context=None)), '1.609487E+48') |
| 2336 | self.assertTrue(c.flags[Inexact]) |
| 2337 | self.assertTrue(c.flags[Rounded]) |
| 2338 | c.clear_flags() |
| 2339 | self.assertRaises(Overflow, y.exp, context=None) |
| 2340 | self.assertTrue(c.flags[Overflow]) |
| 2341 | |
| 2342 | self.assertIs(z.is_normal(context=None), False) |
| 2343 | self.assertIs(z.is_subnormal(context=None), True) |
| 2344 | |
| 2345 | c.clear_flags() |
| 2346 | self.assertEqual(str(x.ln(context=None)), '4.709530') |
| 2347 | self.assertTrue(c.flags[Inexact]) |
| 2348 | self.assertTrue(c.flags[Rounded]) |
| 2349 | c.clear_flags() |
| 2350 | self.assertRaises(InvalidOperation, Decimal(-1).ln, context=None) |
| 2351 | self.assertTrue(c.flags[InvalidOperation]) |
| 2352 | |
| 2353 | c.clear_flags() |
| 2354 | self.assertEqual(str(x.log10(context=None)), '2.045323') |
| 2355 | self.assertTrue(c.flags[Inexact]) |
| 2356 | self.assertTrue(c.flags[Rounded]) |
| 2357 | c.clear_flags() |
| 2358 | self.assertRaises(InvalidOperation, Decimal(-1).log10, context=None) |
| 2359 | self.assertTrue(c.flags[InvalidOperation]) |
| 2360 | |
| 2361 | c.clear_flags() |
| 2362 | self.assertEqual(str(x.logb(context=None)), '2') |
| 2363 | self.assertRaises(DivisionByZero, Decimal(0).logb, context=None) |
| 2364 | self.assertTrue(c.flags[DivisionByZero]) |
| 2365 | |
| 2366 | c.clear_flags() |
| 2367 | self.assertEqual(str(x.logical_invert(context=None)), '1111000') |
| 2368 | self.assertRaises(InvalidOperation, y.logical_invert, context=None) |
nothing calls this directly
no test coverage detected