test IFDRational equality

This commit is contained in:
luphord 2020-07-24 16:17:49 +02:00 committed by Andrew Murray
parent 78e971913c
commit 9db5266fa7

View File

@ -29,6 +29,13 @@ def test_sanity():
_test_equal(1, 2, IFDRational(1, 2)) _test_equal(1, 2, IFDRational(1, 2))
def test_ranges():
for num in range(1, 10):
for denom in range(1, 10):
assert IFDRational(num, denom) == IFDRational(num, denom)
def test_nonetype(): def test_nonetype():
# Fails if the _delegate function doesn't return a valid function # Fails if the _delegate function doesn't return a valid function
@ -43,6 +50,12 @@ def test_nonetype():
assert xres and yres assert xres and yres
def test_nan():
# usually NaN != NaN, but this would break exif self-equality
assert IFDRational(123, 0) == IFDRational(123, 0)
def test_ifd_rational_save(tmp_path): def test_ifd_rational_save(tmp_path):
methods = (True, False) methods = (True, False)
if not features.check("libtiff"): if not features.check("libtiff"):