"""EXIF extractor tests.""" from __future__ import annotations import io from PIL import Image from extractors.features import exif def test_no_exif_is_reported(tmp_path, png_bytes): path = tmp_path / "plain.png" path.write_bytes(png_bytes) res = exif.extract(str(path)) assert res.ok is True assert any("No EXIF" in e for e in res.evidence) assert not res.anomalies def test_editing_software_flagged_as_anomaly(jpeg_with_software): res = exif.extract(jpeg_with_software) assert res.ok is True assert res.results.get("software", "").lower().startswith("adobe photoshop") assert any("Editing/generation software" in a for a in res.anomalies) def test_non_image_returns_error(tmp_path): path = tmp_path / "notimage.bin" path.write_bytes(b"not an image at all") res = exif.extract(str(path)) assert res.ok is False assert res.error