From 7bfaffd5fadda4b1e1e3599db1832d161c133d6a Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 10 May 2021 09:36:57 +1000 Subject: [PATCH] Simplified tests now that casting to float is not needed --- Tests/test_file_tiff.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index 91506f98017..682dc8fd9ac 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -146,25 +146,24 @@ def test_load_float_dpi(self, resolutionUnit, dpi): "Tests/images/hopper_float_dpi_" + str(resolutionUnit) + ".tif" ) as im: assert im.tag_v2.get(RESOLUTION_UNIT) == resolutionUnit - for reloaded_dpi in im.info["dpi"]: - assert float(reloaded_dpi) == dpi + assert im.info["dpi"] == (dpi, dpi) def test_save_float_dpi(self, tmp_path): outfile = str(tmp_path / "temp.tif") with Image.open("Tests/images/hopper.tif") as im: - im.save(outfile, dpi=(72.2, 72.2)) + dpi = (72.2, 72.2) + im.save(outfile, dpi=dpi) with Image.open(outfile) as reloaded: - for dpi in reloaded.info["dpi"]: - assert float(dpi) == 72.2 + assert reloaded.info["dpi"] == dpi def test_save_setting_missing_resolution(self): b = BytesIO() with Image.open("Tests/images/10ct_32bit_128.tiff") as im: im.save(b, format="tiff", resolution=123.45) with Image.open(b) as im: - assert float(im.tag_v2[X_RESOLUTION]) == 123.45 - assert float(im.tag_v2[Y_RESOLUTION]) == 123.45 + assert im.tag_v2[X_RESOLUTION] == 123.45 + assert im.tag_v2[Y_RESOLUTION] == 123.45 def test_invalid_file(self): invalid_file = "Tests/images/flower.jpg"