Improved test coverage

This commit is contained in:
Andrew Murray 2025-01-09 14:49:48 +11:00
parent f938af5c3c
commit a34a9cd6d1
4 changed files with 3 additions and 13 deletions

View File

@ -58,10 +58,7 @@ def test_getiptcinfo_fotostation() -> None:
# Assert # Assert
assert iptc is not None assert iptc is not None
for tag in iptc.keys(): assert 240 in (tag[0] for tag in iptc.keys()), "FotoStation tag not found"
if tag[0] == 240:
return
pytest.fail("FotoStation tag not found")
def test_getiptcinfo_zero_padding() -> None: def test_getiptcinfo_zero_padding() -> None:

View File

@ -492,8 +492,7 @@ def test_plt_marker(card: ImageFile.ImageFile) -> None:
out.seek(0) out.seek(0)
while True: while True:
marker = out.read(2) marker = out.read(2)
if not marker: assert marker, "End of stream without PLT"
pytest.fail("End of stream without PLT")
jp2_boxid = _binary.i16be(marker) jp2_boxid = _binary.i16be(marker)
if jp2_boxid == 0xFF4F: if jp2_boxid == 0xFF4F:

View File

@ -36,11 +36,7 @@ class LibTiffTestCase:
im.load() im.load()
im.getdata() im.getdata()
try:
assert im._compression == "group4" assert im._compression == "group4"
except AttributeError:
print("No _compression")
print(dir(im))
# can we write it back out, in a different form. # can we write it back out, in a different form.
out = str(tmp_path / "temp.png") out = str(tmp_path / "temp.png")

View File

@ -189,8 +189,6 @@ class TestImage:
if ext == ".jp2" and not features.check_codec("jpg_2000"): if ext == ".jp2" and not features.check_codec("jpg_2000"):
pytest.skip("jpg_2000 not available") pytest.skip("jpg_2000 not available")
temp_file = str(tmp_path / ("temp." + ext)) temp_file = str(tmp_path / ("temp." + ext))
if os.path.exists(temp_file):
os.remove(temp_file)
im.save(Path(temp_file)) im.save(Path(temp_file))
def test_fp_name(self, tmp_path: Path) -> None: def test_fp_name(self, tmp_path: Path) -> None: