Livrare LOT 1 - Didi
This commit is contained in:
commit
5380c3fc63
990 changed files with 133308 additions and 0 deletions
22
ai_platform/modules/extractors/tests/test_ela.py
Normal file
22
ai_platform/modules/extractors/tests/test_ela.py
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"""ELA extractor tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from extractors.features import ela
|
||||
|
||||
|
||||
def test_ela_returns_stats(tmp_path, jpeg_bytes):
|
||||
path = tmp_path / "img.jpg"
|
||||
path.write_bytes(jpeg_bytes)
|
||||
res = ela.extract(str(path))
|
||||
assert res.ok is True
|
||||
for key in ("mean_error", "max_error", "p99_error", "hot_pixel_fraction"):
|
||||
assert key in res.results
|
||||
assert 0.0 <= res.results["hot_pixel_fraction"] <= 1.0
|
||||
|
||||
|
||||
def test_ela_on_bad_input(tmp_path):
|
||||
path = tmp_path / "x.bin"
|
||||
path.write_bytes(b"\x00\x01\x02")
|
||||
res = ela.extract(str(path))
|
||||
assert res.ok is False
|
||||
Loading…
Add table
Add a link
Reference in a new issue