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