9194ef5abd
Docs/Test Workflow / Test docs build (push) Failing after 0s
Check links & references / links-check (push) Failing after 1s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.10) (push) Failing after 0s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.11) (push) Failing after 0s
PR Conflict Labeler / main (push) Failing after 2s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.12) (push) Failing after 2s
Pytest/Test Workflow / Import Test and Pytest Run (ubuntu-latest, 3.13) (push) Failing after 0s
Pytest/Test Workflow / Build this Package (push) Failing after 5s
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.10) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.11) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.12) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (macos-latest, 3.13) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.10) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.11) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.12) (push) Has been cancelled
Pytest/Test Workflow / Import Test and Pytest Run (windows-latest, 3.13) (push) Has been cancelled
Pytest/Test Workflow / testing-guardian (push) Has been cancelled
99 lines
2.7 KiB
Python
99 lines
2.7 KiB
Python
import os
|
|
|
|
import cv2
|
|
import numpy as np
|
|
from _pytest.fixtures import fixture
|
|
from PIL import Image
|
|
|
|
ASSETS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "assets"))
|
|
ALL_IMAGES_LIST = [os.path.join(ASSETS_DIR, f"{i}.jpg") for i in range(1, 6)]
|
|
|
|
|
|
@fixture(scope="function")
|
|
def empty_cv2_image() -> np.ndarray:
|
|
return np.zeros((128, 128, 3), dtype=np.uint8)
|
|
|
|
|
|
@fixture(scope="function")
|
|
def empty_pillow_image() -> Image.Image:
|
|
return Image.new(mode="RGB", size=(128, 128), color=(0, 0, 0))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def all_images() -> list[np.ndarray]:
|
|
return [cv2.imread(path) for path in ALL_IMAGES_LIST]
|
|
|
|
|
|
@fixture(scope="function")
|
|
def one_image() -> np.ndarray:
|
|
return cv2.imread(ALL_IMAGES_LIST[0])
|
|
|
|
|
|
@fixture(scope="function")
|
|
def two_images() -> list[np.ndarray]:
|
|
return [cv2.imread(path) for path in ALL_IMAGES_LIST[:2]]
|
|
|
|
|
|
@fixture(scope="function")
|
|
def three_images() -> list[np.ndarray]:
|
|
return [cv2.imread(path) for path in ALL_IMAGES_LIST[:3]]
|
|
|
|
|
|
@fixture(scope="function")
|
|
def four_images() -> list[np.ndarray]:
|
|
return [cv2.imread(path) for path in ALL_IMAGES_LIST[:4]]
|
|
|
|
|
|
@fixture(scope="function")
|
|
def all_images_tile() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "all_images_tile.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def all_images_tile_and_custom_colors() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "all_images_tile_and_custom_colors.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def all_images_tile_and_custom_grid() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "all_images_tile_and_custom_grid.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def four_images_tile() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "four_images_tile.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def single_image_tile() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "single_image_tile.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def single_image_tile_enforced_grid() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "single_image_tile_enforced_grid.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def three_images_tile() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "three_images_tile.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def two_images_tile() -> np.ndarray:
|
|
return cv2.imread(os.path.join(ASSETS_DIR, "two_images_tile.png"))
|
|
|
|
|
|
@fixture(scope="function")
|
|
def all_images_tile_and_custom_colors_and_titles() -> np.ndarray:
|
|
return cv2.imread(
|
|
os.path.join(ASSETS_DIR, "all_images_tile_and_custom_colors_and_titles.png")
|
|
)
|
|
|
|
|
|
@fixture(scope="function")
|
|
def all_images_tile_and_titles_with_custom_configs() -> np.ndarray:
|
|
return cv2.imread(
|
|
os.path.join(ASSETS_DIR, "all_images_tile_and_titles_with_custom_configs.png")
|
|
)
|