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

Method test_torture

Lib/test/test_statistics.py:1246–1255  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1244
1245class SumTortureTest(NumericTestCase):
1246 def test_torture(self):
1247 # Tim Peters' torture test for sum, and variants of same.
1248 self.assertEqual(statistics._sum([1, 1e100, 1, -1e100]*10000),
1249 (float, Fraction(20000.0), 40000))
1250 self.assertEqual(statistics._sum([1e100, 1, 1, -1e100]*10000),
1251 (float, Fraction(20000.0), 40000))
1252 T, num, count = statistics._sum([1e-100, 1, 1e-100, -1]*10000)
1253 self.assertIs(T, float)
1254 self.assertEqual(count, 40000)
1255 self.assertApproxEqual(float(num), 2.0e-96, rel=5e-16)
1256
1257
1258class SumSpecialValues(NumericTestCase):

Callers

nothing calls this directly

Calls 4

FractionClass · 0.90
assertApproxEqualMethod · 0.80
assertEqualMethod · 0.45
assertIsMethod · 0.45

Tested by

no test coverage detected