o2o-site-AEO/solution/backend/tests/test_catchphrase_text.py
Mina Choi ef0c44c5f2 [feat] solution/backend: 수집 뒤 콘텐츠 채울 때 캐치프레이즈·순환 문구 생성 — 숙박만
가게별 첫 화면 문구를 만드는 곳이 없어 모든 숙박이 공통 문구 10개를 돌려 썼다.

- COPY 잡에 catchphrase 단계(prepare→generate→save→catchphrase→faq_fill), 숙박이 아니면 건너뜀
- prompts/catchphrase.py·gemini_text.generate_catchphrases: 캐치프레이즈 1 + 일반 20·계절 3×4·월 12·날씨 2×4.
  문구마다 길이·상호명·ground_check(근거 없는 시설·수치) 검사
- fact tagline·catchphrases(lodging 스키마, allow_llm). 순환 문구는 사장님이 줄 단위로 고치게 글로 저장
  (catchphrase_text: `봄 | ` · `9월 | ` · `비 | ` 머리)
- site_payload: narrative.tagline·catchphrases 로 넘기고 이용정보 표(facts)에서는 뺀다
- 빌더 생성 화면 단계 문구, DATA_MODEL·GENERATION_FLOW

테스트 6건 추가. 관련 20개 파일 386 passed · 실패 102건은 main 과 목록이 같다(기존 실패)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:33:17 +09:00

27 lines
1.1 KiB
Python

"""순환 문구 글 형식 — 사장님이 줄 단위로 고친 글이 그대로 계절·월·날씨 문구로 읽혀야 한다."""
from services import catchphrase_text
def test_round_trips_every_kind():
items = [
{"text": "백 년 된 집에서 하룻밤", "kind": "general"},
{"text": "봄에는 대문을 열어 둡니다", "kind": "season", "season": "봄"},
{"text": "새해 첫 아침을 이 집에서", "kind": "month", "month": 1},
{"text": "기와에 빗소리가 납니다", "kind": "weather", "weather": "비"},
]
text = catchphrase_text.encode(items)
assert text.splitlines() == [
"백 년 된 집에서 하룻밤",
"봄 | 봄에는 대문을 열어 둡니다",
"1월 | 새해 첫 아침을 이 집에서",
"비 | 기와에 빗소리가 납니다",
]
assert catchphrase_text.decode(text) == items
def test_unknown_tag_stays_a_general_line():
assert catchphrase_text.decode("장마 | 비가 옵니다\n\n 13월 | 없는 달 ") == [
{"text": "장마 | 비가 옵니다", "kind": "general"},
{"text": "13월 | 없는 달", "kind": "general"},
]