o2o-site-AEO/solution/backend/tests/test_weather_notes.py
Mina Choi 820a2e9e35 feat(site): 오늘의 날씨 문구 로딩과 조건별 순환 추가
목업에만 있던 날씨 문구 계약을 제품 payload와 렌더러에 연결한다. 군산 전용 장소를 다른 사업장에 복사하지 않도록 공통 안내를 별도 JSON으로 관리한다.

날씨 변환 단위 테스트 3건, 렌더링 테스트 3건 및 TypeScript·ESLint 통과. 전체 발행 테스트는 깨끗한 renderer 재빌드 후 별도 확인.
2026-09-15 16:23:53 +09:00

25 lines
1.0 KiB
Python

from services.weather_notes import weather_notes
from services.site_payload import _weather
def test_all_weather_cases_have_five_unique_lines():
notes = weather_notes()
assert set(notes["noteSets"]) == {"맑음", "구름많음", "흐림", "비", "눈"}
assert set(notes["tempNoteSets"]) == {"혹서", "더움", "선선", "쌀쌀", "추움"}
lines = [line for key in ("noteSets", "tempNoteSets") for group in notes[key].values() for line in group]
assert len(lines) == len(set(lines)) == 50
def test_templates_are_not_mutated_by_a_payload():
notes = weather_notes()
notes["noteSets"]["비"].clear()
assert len(weather_notes()["noteSets"]["비"]) == 5
def test_payload_attaches_notes_only_to_real_observations():
assert _weather({"body": {}}) is None
weather = _weather({"body": {"temperature": 0, "weather_code": 71, "observed_at": "2026-09-15T12:00"}})
assert weather["condition"] == "눈"
assert weather["temperature"] == 0
assert len(weather["tempNoteSets"]["추움"]) == 5