If you want something that works not only with floats but for example Decimals you can use python's math.isclose:
# - rel_tol=0.01` is 1% difference tolerance.
assert math.isclose(actual_value, expected_value, rel_tol=0.01)
Docs - https://docs.python.org/3/library/math.html#math.isclose