"""Unit tests for pure logic — no backend required. Run: python test_smoke.py """ import json from frames import build_prompt, seed_for, SIZES from schemas import validate_package # --- seeding (FR-2.3 / FR-2.4) --- assert seed_for(1, 0) == 1042 assert seed_for(2, 0) == 2042 assert seed_for(2, 1) == 2043 # regen bumps seed assert seed_for(2, 0) != seed_for(2, 1) assert len({seed_for(i, 0) for i in range(1, 6)}) == 5 # all distinct print("seed_for OK") # --- sizes (FR-2.6) --- assert SIZES["1:1"] == (1024, 1024) assert SIZES["16:9"] == (1024, 576) print("SIZES OK") # --- schema validation round-trip --- RAW = { "product_analysis": { "product_type": "ceramic mug", "materials": "stoneware", "colors": ["#4A6B5D"], "distinguishing_features": "speckled glaze", }, "shots": [ {"id": i, "concept_name": f"Concept {i}", "scene": "studio", "camera_angle": "front", "lighting": "soft", "color_palette": ["#4A6B5D", "#E8E2D5"], "props": "none", "marketing_angle": "quality", "image_prompt": f"prompt {i}"} for i in range(1, 6) ], } pkg = validate_package(RAW) assert len(pkg.shots) == 5 assert json.loads(pkg.to_json())["shots"][0]["id"] == 1 print("validate_package OK") # --- prompt building (FR-2.3) --- p = build_prompt(pkg.shots[0], "Minimal") assert "prompt 1" in p and "#4A6B5D" in p print("build_prompt OK") print() print("ALL SMOKE TESTS PASSED")