Test involving Floating Point
def test_with_limited_precision( self ):
self.
assertAlmostEqual
(
2.33333333, average([1,2,4]),
places=8
)
Calculations using floating point values often result in
rounding error
or
finite-precision error
.
This is normal.
To test a result which may have
rounding error
, use
assertAlmostEqual