Files
Jyotisha/tests/test_user_layer_leftovers_2034.py
T
ClaudeandClaude Fable 5.2 def4c986bb
Independent Staging Quality Gate / validate-frontend (push) Successful in 5m31s
Independent Staging Quality Gate / validate-python (push) Successful in 7m0s
Independent Staging Quality Gate / publish (push) Successful in 3m34s
fix: plain advice, plain distances and dates, no grade letters in the annual report, named people in synastry analysis (BUG-2034)
Reader-layer leftovers from the round-eight staging retest (astrologer's
2026-11-19 layering rule; owner's no-hedging rule).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
2026-11-19 18:29:42 +08:00

52 lines
3.1 KiB
Python

"""BUG-2034 (staging 复测第八轮, 2026-11-19): reader wording in the report facts and the opening."""
from scripts.report_render.birth_precision_margins import _margin_summary_zh
from scripts.report_render.birth_precision_window import birth_window_label_zh, plain_minutes_zh
from scripts.report_render.opening_guide import NARAYANA_OPEN_READER_ZH, _reader_narayana_status
from scripts.report_render.transit_natal_sign import sade_sati_summary_zh
def test_a_distance_in_birth_time_is_written_in_minutes_and_seconds():
assert plain_minutes_zh(5.017) == "5 分 1 秒"
assert plain_minutes_zh(8.433) == "8 分 26 秒"
assert plain_minutes_zh(0.3) == "18 秒"
assert plain_minutes_zh(71.517) == "71 分 31 秒"
# Whole minutes keep the wording reports already used.
assert plain_minutes_zh(19) == "19 分钟" and plain_minutes_zh(240.0) == "240 分钟" and plain_minutes_zh(0) == "0 分钟"
def test_the_boundary_summary_and_the_window_label_carry_no_decimal_minutes():
# 复测第八轮「依据与边界」: 「出生时间提前 5.017 分钟上升就换座;推后 8.433 分钟才换座」
summary = _margin_summary_zh(5.017, 8.433, 240, {"before_minutes": 6.5, "after_minutes": 1.7, "source": "rectified_range"})
assert summary == "出生时间提前 5 分 1 秒上升就换座;推后 8 分 26 秒才换座。区间内会换座。"
label = birth_window_label_zh({
"source": "rectified_range", "before_minutes": 6.5, "after_minutes": 1.7,
"start_at": "1997-08-08T04:51:30", "end_at": "1997-08-08T04:59:42",
})
assert label == "按生时纠正选定的区间 04:51–04:59(前 6 分 30 秒、后 1 分 42 秒)"
for text in (summary, label):
assert "." not in text
def test_the_sade_sati_fact_sentence_writes_its_date_the_way_the_reading_does():
kantaka = {"house": 7, "kantaka": True, "ashtama_shani": False, "until": "2027-05-20"}
assert sade_sati_summary_zh(False, kantaka).endswith("2027 年 5 月 20 日离开这个星座。")
assert "2027-05-20" not in sade_sati_summary_zh(False, kantaka)
def test_the_reader_opening_says_one_plain_sentence_about_an_unresolved_narayana():
unresolved = {
"method_status": {
"status": "candidate", "unresolved_steps": ["ad_start"],
"text": "Vimshottari 提供主要时间框架。Narayana 的当前分支按来源版各步 profile 计算,保留为条件性窗口,暂不作为双体系确认。",
},
"branches": [{"branch_id": "ad:1:Virgo:start=Virgo", "unresolved_step": "ad_start", "md_sign": "Virgo"}],
"current_dasha": {"md": "Libra"},
}
assert _reader_narayana_status(unresolved, "zh") == [NARAYANA_OPEN_READER_ZH]
for word in ("口径", "profile", "候选分支", "条件性窗口", "未决", "`"):
assert word not in NARAYANA_OPEN_READER_ZH
# The English opening is unchanged and still lists the status lines.
assert len(_reader_narayana_status(unresolved, "en")) > 1
assert _reader_narayana_status({"method_status": {"status": "determined"}, "current_dasha": {"md": "Leo"}}, "zh") == []