Files
physicalCombinatorics/tests/test_combinator.py
Simonson, Andrew 8118a62242 Add Flask web UI, Docker Compose, core engine + tests
- physcom core: CLI, 5-pass pipeline, SQLite repo, 37 tests
- physcom_web: Flask app with HTMX for entity/domain/pipeline/results CRUD
- Docker Compose: web + cli services sharing a named volume for the DB
- Clean up local settings to use wildcard permissions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 13:59:53 -06:00

27 lines
879 B
Python

"""Tests for the Cartesian product combinator."""
import pytest
from physcom.engine.combinator import generate_combinations
from physcom.models.entity import Entity
def test_generates_cartesian_product(seeded_repo):
combos = generate_combinations(seeded_repo, ["platform", "power_source"])
# 9 platforms x 9 power sources = 81
assert len(combos) == 81
def test_each_combo_has_one_per_dimension(seeded_repo):
combos = generate_combinations(seeded_repo, ["platform", "power_source"])
for combo in combos:
dims = [e.dimension for e in combo.entities]
assert "platform" in dims
assert "power_source" in dims
assert len(combo.entities) == 2
def test_missing_dimension_raises(seeded_repo):
with pytest.raises(ValueError, match="No entities found"):
generate_combinations(seeded_repo, ["platform", "nonexistent"])