mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-14 05:36:48 +03:00
Add assert_almost_equal() for testing float numbers
This commit is contained in:
parent
74f83b7c5b
commit
b7aafa2036
|
@ -67,6 +67,12 @@ def assert_equal(a, b, msg=None):
|
||||||
else:
|
else:
|
||||||
failure(msg or "got %r, expected %r" % (a, b))
|
failure(msg or "got %r, expected %r" % (a, b))
|
||||||
|
|
||||||
|
def assert_almost_equal(a, b, msg=None, eps=1e-6):
|
||||||
|
if abs(a-b) < eps:
|
||||||
|
success()
|
||||||
|
else:
|
||||||
|
failure(msg or "got %r, expected %r" % (a, b))
|
||||||
|
|
||||||
def assert_deep_equal(a, b, msg=None):
|
def assert_deep_equal(a, b, msg=None):
|
||||||
try:
|
try:
|
||||||
if len(a) == len(b):
|
if len(a) == len(b):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user