fix(saju-lab): reference fixture 재생성 (solarlunar gzMonth 기반 + xfail 제거)
이전 fixture는 saju-web `getCurrentSolarTerm` 루프 버그로 30 케이스 모두 month branch='丑'으로 고정되어 검증 불가했음. saju-web을 임시 패치(solarlunar.gzMonth 직접 사용)하여 재생성한 뒤 패치는 되돌렸음. 결과: 12개 unique month branch + sxtwl과 49 테스트 전부 PASS. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
5385
saju-lab/tests/fixtures/reference_saju.json
vendored
5385
saju-lab/tests/fixtures/reference_saju.json
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,13 +1,13 @@
|
||||
"""solar_terms.py — sxtwl 기반 24절기 + 月支 매핑 테스트.
|
||||
|
||||
⚠️ Reference fixture(`reference_saju.json`)의 month branch는 모두 "丑"으로 동일하다.
|
||||
이는 saju-web의 `solar-terms.ts`가 tsx 런타임에서 `require('solarlunar')`를 잡지 못해
|
||||
fallback(`return 23`, 大寒)으로 떨어지고, 大寒 → 丑 매핑이 적용된 결과로 보인다.
|
||||
따라서 reference fixture는 절기 검증에 사용할 수 없으며, 본 테스트는
|
||||
Reference fixture(`reference_saju.json`)는 saju-web의 solarlunar gzMonth를 직접 사용해
|
||||
재생성되었다 (이전 버전은 `getCurrentSolarTerm` 루프 버그로 모든 케이스가 月支='丑'으로 떨어졌음).
|
||||
본 테스트는
|
||||
- 절기 boundary (입춘 day) 동작 검증
|
||||
- sxtwl JieQi index 순서 가정 검증
|
||||
- 月支 자체 일관성(여러 날짜에서 기대되는 月支 산출) 검증
|
||||
세 가지로 구성한다.
|
||||
- Reference fixture 30 케이스 sxtwl ↔ solarlunar 일치 검증
|
||||
네 가지로 구성한다.
|
||||
"""
|
||||
import json
|
||||
from pathlib import Path
|
||||
@@ -106,24 +106,11 @@ def test_get_days_to_next_solar_term_positive():
|
||||
ids=lambda c: f"{c['input']['year']}-{c['input']['month']:02d}-{c['input']['day']:02d}",
|
||||
)
|
||||
def test_month_branch_matches_reference(case):
|
||||
"""Reference fixture의 month branch와 sxtwl 기반 절기 계산 일치.
|
||||
|
||||
⚠️ 알려진 이슈: reference_saju.json의 모든 30 케이스 month branch가 "丑"으로 동일하다.
|
||||
이는 saju-web `solar-terms.ts`가 tsx 런타임에서 solarlunar require 실패 →
|
||||
`return 23` 폴백 → 大寒 → 丑으로 떨어진 reference 측 버그.
|
||||
|
||||
본 테스트는 BUGGY reference와 일치하는지 검증하기 위한 것이 아니라,
|
||||
sxtwl 기반 계산이 reference와 자연스럽게 어긋남을 명시적으로 기록하기 위해 xfail로 마킹.
|
||||
"""
|
||||
"""Reference fixture의 month branch(solarlunar gzMonth 기준)와 sxtwl 계산 일치."""
|
||||
inp = case["input"]
|
||||
expected_branch = case["expected"]["saju"]["month"]["branch"]
|
||||
branch_idx = st.get_solar_term_month_branch(inp["year"], inp["month"], inp["day"])
|
||||
actual_branch = BRANCHES[branch_idx]
|
||||
if expected_branch == "丑":
|
||||
pytest.xfail(
|
||||
f"reference_saju.json buggy: 모든 케이스 month='丑'으로 고정. "
|
||||
f"sxtwl 정답은 {actual_branch} (input={inp})"
|
||||
)
|
||||
assert actual_branch == expected_branch, (
|
||||
f"mismatch for {inp}: got {actual_branch}, expected {expected_branch}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user