Livrare LOT 1 - Didi
This commit is contained in:
commit
5380c3fc63
990 changed files with 133308 additions and 0 deletions
33
ai_platform/modules/extractors/tests/test_exif.py
Normal file
33
ai_platform/modules/extractors/tests/test_exif.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
"""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
|
||||
Loading…
Add table
Add a link
Reference in a new issue