Tighten up test of harmonic mean on a single value.

This commit is contained in:
Steven D'Aprano 2016-08-09 13:19:48 +10:00
parent 3e8616abcd
commit e7fef52f98
1 changed files with 1 additions and 4 deletions

View File

@ -1469,10 +1469,7 @@ class TestHarmonicMean(NumericTestCase, AverageMixin, UnivariateTypeMixin):
def test_singleton_lists(self): def test_singleton_lists(self):
# Test that harmonic mean([x]) returns (approximately) x. # Test that harmonic mean([x]) returns (approximately) x.
for x in range(1, 101): for x in range(1, 101):
if x in (49, 93, 98, 99): self.assertEqual(self.func([x]), x)
self.assertApproxEqual(self.func([x]), x, tol=2e-14)
else:
self.assertEqual(self.func([x]), x)
def test_decimals_exact(self): def test_decimals_exact(self):
# Test harmonic mean with some carefully chosen Decimals. # Test harmonic mean with some carefully chosen Decimals.