"""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