Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| from pathlib import Path | |
| import sys | |
| ROOT = Path(__file__).resolve().parents[1] | |
| SRC = ROOT / "src" | |
| if str(SRC) not in sys.path: | |
| sys.path.insert(0, str(SRC)) | |
| from apps.p5_memory_quilt.demo_pack_loader import load_default_demo_pack, sample_memories | |
| def test_demo_pack_loads_and_has_expected_assets() -> None: | |
| pack = load_default_demo_pack() | |
| assert pack.pack_id == "p5_memory_quilt" | |
| assert len(pack.memories) >= 6 | |
| assert len(pack.photos) >= 4 | |
| assert pack.style == "Fabric Quilt" | |
| sampled = sample_memories(pack, count=6) | |
| assert len(sampled) == 6 | |
| assert all(memory.text for memory in sampled) | |
| assert len({memory.text for memory in sampled}) == len(sampled) | |
| for photo in pack.photos: | |
| assert photo.exists(), photo | |
| assert photo.suffix.lower() == ".png" | |
| assert photo.read_bytes()[:8] == b"\x89PNG\r\n\x1a\n" | |