Files
Jyotisha/tests/test_chart_choice_structure_only_2132.py
T
ClaudeandClaude Opus 5.5 c49837b0cc
Independent Staging Quality Gate / validate-python (push) Successful in 10m3s
Independent Staging Quality Gate / validate-frontend (push) Successful in 13m22s
Independent Staging Quality Gate / publish (push) Successful in 3m16s
fix(rect): self-choice cards show structure only; no placement read out as a life conclusion, no pick-by-resemblance copy (BUG-2132)
The astrologer's 11-21 reply (owner agreed): single positions cannot be turned
into personality, money or family conclusions, nor can resemblance picks narrow
a birth time. describe() now emits facts only; resemblance questions are retired.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
2026-11-21 19:50:04 +08:00

64 lines
2.7 KiB
Python

"""BUG-2132: the self-choice page shows structure only, never a placement turned into a life conclusion.
占星师 2026-11-21 (负责人同意): single positions (a domain lord in a house, a planet in a domain house,
the D2 Hora, the D6/D8 ascendant element) must not be read out as personality, money habits or family
facts for the user to pick a birth time by resemblance.
"""
from __future__ import annotations
import itertools
from scripts.chart_choice import readings
from scripts.chart_choice.readings import DOMAIN, build_question, describe
SENTENCES = {
*readings.PLANET_TONE.values(),
*(line for table in readings.LORD_IN_HOUSE.values() for line in table),
*(text for _half, text in readings.HORA_TEXT.values()),
*(line for lines in readings.SUPPLEMENTAL_TONES.values() for line in lines),
}
PLANETS = ("Sun", "Moon", "Mars", "Mercury", "Jupiter", "Venus", "Saturn", "Rahu", "Ketu")
def _charts():
"""Every ascendant sign, with the planets spread over the houses so occupants and lords all occur."""
for asc, shift in itertools.product(range(12), range(0, 12, 3)):
chart = {"Ascendant": asc}
chart.update({planet: (asc + shift + i) % 12 for i, planet in enumerate(PLANETS)})
yield chart
def test_every_domain_chart_reads_as_structure_only() -> None:
for chart_key in DOMAIN:
for chart in _charts():
reading = describe(chart_key, chart)
assert reading["points"], (chart_key, chart)
for point in reading["points"]:
assert point["meaning"] == "", (chart_key, point)
assert point["fact"], (chart_key, point)
assert not any(sentence in point["fact"] for sentence in SENTENCES if sentence), (chart_key, point)
def test_d2_names_only_the_hora() -> None:
for chart in _charts():
if chart["Ascendant"] not in (3, 4): # a D2 ascendant is always Cancer or Leo
continue
fact = describe("D2", chart)["points"][0]["fact"]
assert fact.startswith("上升落在太阳 Hora") or fact.startswith("上升落在月亮 Hora"), fact
assert "钱" not in fact
def test_d6_d8_show_only_the_ascendant() -> None:
for chart_key in ("D6", "D8"):
for chart in _charts():
points = describe(chart_key, chart)["points"]
assert [point["kind"] for point in points] == ["ascendant"]
assert points[0]["fact"].startswith("上升落在")
def test_no_resemblance_question_is_built() -> None:
for chart_key in DOMAIN:
charts = list(_charts())
for before, after in zip(charts, charts[1:]):
assert build_question(describe(chart_key, before), describe(chart_key, after)) is None