gendesign/backend/tests/test_concepts_stub.py
Light1YT 3b79533f9f
Some checks failed
CI / changes (push) Successful in 7s
CI / frontend-tests (push) Has been skipped
CI / backend-tests (push) Has been cancelled
feat(generative): движок концепций Stage 1a/1b/1c (#54 #55 #56)
Заменяет generative stubs детерминированным end-to-end пайплайном:
- 1a geometry: WGS84-parse, метрическая AEQD-репроекция, setback-буфер, placement grid
- 1b placement: greedy section-fill + STRtree коллизии (full-gap), 3 стратегии, coverage cap
- 1c teap/financial: площади/квартиры/FAR/паркинг; выручка/затраты/маржа + IRR-proxy
- exporters: ezdxf DXF (геометрия) + WeasyPrint ТЭП/фин PDF (lazy import)
generate() заменил generate_stub в route (422 на degenerate). mypy-strict + ruff clean,
31 generative-тест + full suite 3078 passed. ConceptVariant заполняется реальными числами.

Closes #54
Closes #55
Closes #56
2026-06-13 21:32:32 +05:00

40 lines
1.2 KiB
Python

"""Smoke test for the Concept endpoint shape (3 strategies present).
The stub is now replaced by the real Stage 1a/1b/1c pipeline; richer assertions on
filled ТЭП/financial live in tests/services/generative/test_api_concepts.py. This
file is kept as a minimal endpoint-shape smoke.
"""
from fastapi.testclient import TestClient
from app.main import app
def test_concept_stub_returns_three_variants() -> None:
client = TestClient(app)
payload = {
"parcel_geojson": {
"type": "Polygon",
"coordinates": [
[
[60.6, 56.83],
[60.61, 56.83],
[60.61, 56.84],
[60.6, 56.84],
[60.6, 56.83],
]
],
},
"housing_class": "comfort",
"target_floors": 9,
"development_type": "mid_rise",
}
response = client.post("/api/v1/concepts", json=payload)
assert response.status_code == 200
variants = response.json()["variants"]
assert len(variants) == 3
assert {v["strategy"] for v in variants} == {
"max_area",
"max_insolation",
"balanced",
}