o2o-site-AEO/solution/backend/tests/test_weather_notes.py
Mina Choi 11d30bb3d1 [chore] solution,admin,ontology: 코드 주석을 한 줄로 — 히스토리 주석 삭제
여러 줄 주석이 설명보다 경위(예전·실측·지적)를 적고 있어 읽는 사람이 결론을 찾기 어려웠다.

- ts·tsx·js·mjs·css·py 478개: 여러 줄 주석은 첫 문장 한 줄로, 과거형·날짜 문장은 삭제
- 주석 위치는 TypeScript 파서·파이썬 tokenize/ast 로 찾는다 — 문자열 안의 # · /* 는 건드리지 않는다
- eslint·ts·noqa·type: ignore 같은 지시 주석은 그대로 둔다

파이썬 275개 정리 전후 AST 동일, TS 298개 주석 뺀 토큰 동일(빈 JSX 주석 10곳만 차이).
site·frontend·admin tsc, site vitest 105 passed

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-28 16:05:19 +09:00

26 lines
1.1 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]
# 하늘 9 · 기온대 5, 케이스마다 다섯 줄.
assert len(lines) == len(set(lines)) == 70
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