Livrare LOT 1 - Didi
This commit is contained in:
commit
5380c3fc63
990 changed files with 133308 additions and 0 deletions
45
ai_platform/modules/extractors/tests/conftest.py
Normal file
45
ai_platform/modules/extractors/tests/conftest.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"""Shared test fixtures: synthetic media generated in-memory."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
|
||||
import numpy as np
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def jpeg_bytes() -> bytes:
|
||||
"""A small valid JPEG with no EXIF."""
|
||||
|
||||
img = Image.fromarray(
|
||||
(np.random.default_rng(0).random((64, 64, 3)) * 255).astype("uint8")
|
||||
)
|
||||
buf = io.BytesIO()
|
||||
img.save(buf, format="JPEG", quality=85)
|
||||
return buf.getvalue()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def png_bytes() -> bytes:
|
||||
"""A small valid PNG."""
|
||||
|
||||
img = Image.new("RGB", (48, 48), (120, 30, 200))
|
||||
buf = io.BytesIO()
|
||||
img.save(buf, format="PNG")
|
||||
return buf.getvalue()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def jpeg_with_software(tmp_path):
|
||||
"""Write a JPEG carrying a Photoshop Software EXIF tag; return its path."""
|
||||
|
||||
from PIL import Image as PImage
|
||||
|
||||
img = PImage.new("RGB", (32, 32), (10, 20, 30))
|
||||
exif = img.getexif()
|
||||
exif[0x0131] = "Adobe Photoshop 25.0" # Software tag
|
||||
path = tmp_path / "edited.jpg"
|
||||
img.save(path, format="JPEG", exif=exif)
|
||||
return str(path)
|
||||
Loading…
Add table
Add a link
Reference in a new issue