in flsim/common/pytest_helper.py [0:0]
def assertAlmostEqual(first, second, places=None, msg=None, delta=None):
"""Assert that ``first`` and ``second`` is almost equal to each other.
The equality of ``first`` and ``second`` is determined in a similar way to
the ``assertAlmostEqual`` function of the standard library.
"""
if delta is not None and places is not None:
raise TypeError("specify delta or places - not both")
msg: str = ""
diff = abs(second - first)
if delta is not None:
if diff <= delta:
return
msg = (
f"The difference between {first} and {second} is not within {delta} delta."
)
else:
if places is None:
places = 7
if round(diff, places) == 0:
return
msg = f"The difference between {first} and {second} is not within {places} decimal places."
raise AssertionError(msg)