from __future__ import annotations import sys from pathlib import Path import pytest pytest.importorskip("matplotlib") sys.path.insert(0, str(Path(__file__).resolve().parent.parent / "scripts")) from make_gallery import make_gallery # noqa: E402 from kitti_c2l.assets import generate_sequence_assets from kitti_c2l.generate import generate_sequence_rows from kitti_c2l.sequence_mapping import SequenceInfo from kitti_c2l.stages import STAGES from kitti_c2l.writer import write_assets, write_split @pytest.fixture def demo_data(fake_kitti_root: Path, tmp_path: Path) -> tuple[Path, Path]: seq_info = SequenceInfo(sequence="04", date="2011_09_30", drive="0016", start=0, end=3, frame_count=4, split="train") metadata_path = tmp_path / "train.parquet" write_split(generate_sequence_rows(seq_info, fake_kitti_root, stages=STAGES), metadata_path) assets_path = tmp_path / "frames_train.parquet" write_assets(generate_sequence_assets(seq_info, fake_kitti_root), assets_path) return metadata_path, assets_path def test_make_gallery_writes_a_nonempty_png(demo_data: tuple[Path, Path], tmp_path: Path): metadata_path, assets_path = demo_data output_path = make_gallery( metadata_path, [("04", 1, assets_path)], stages=[1, 3, 5], output_path=tmp_path / "gallery.png" ) assert output_path.exists() assert output_path.stat().st_size > 0