assert_almost_equal

assert_almost_equal(*args)

Raises an exception if two objects are not equal up to desired tolerance.

Similar to numpy.testing.assert_allclose.

Parameters:
a, bfloat, Point, Matrix, Distribution, Mesh, Field or ProcessSample

Elements to compare

rtolfloat

Relative tolerance, default is 1e-5

atolfloat

Absolute tolerance, default is 1e-8

errMsgstr

Error message emitted when comparison fails

Examples

>>> import openturns as ot
>>> import openturns.testing as ott
>>> dist = ot.Uniform(0.0, 1.0)
>>> ott.assert_almost_equal(dist.getMean(), [0.5])