MCPcopy Index your code
hub / github.com/python/cpython / test_logs

Method test_logs

Lib/test/test_long.py:513–529  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

511 "float(shuge) should not equal int(shuge)")
512
513 def test_logs(self):
514 LOG10E = math.log10(math.e)
515
516 for exp in list(range(10)) + [100, 1000, 10000]:
517 value = 10 ** exp
518 log10 = math.log10(value)
519 self.assertAlmostEqual(log10, exp)
520
521 # log10(value) == exp, so log(value) == log10(value)/log10(e) ==
522 # exp/LOG10E
523 expected = exp / LOG10E
524 log = math.log(value)
525 self.assertAlmostEqual(log, expected)
526
527 for bad in -(1 << 10000), -2, 0:
528 self.assertRaises(ValueError, math.log, bad)
529 self.assertRaises(ValueError, math.log10, bad)
530
531 def test_mixed_compares(self):
532 eq = self.assertEqual

Callers

nothing calls this directly

Calls 5

listClass · 0.85
log10Method · 0.45
assertAlmostEqualMethod · 0.45
logMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected