Files
Jyotisha/tests/public_chart_reports.py
T
ClaudeandClaude Opus 5.5 713deb83f7
Independent Staging Quality Gate / validate-frontend (push) Successful in 5m37s
Independent Staging Quality Gate / validate-python (push) Successful in 7m15s
Independent Staging Quality Gate / publish (push) Successful in 2m42s
fix(report): the expression-path hook lives in the report API, not in the frozen jyotish_engine.py; public test reports attach it the same way (BUG-2296)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
2026-11-24 07:51:43 +08:00

30 lines
1.4 KiB
Python

"""Cached full-data reports for the repository's public chart fixtures."""
from copy import deepcopy
from functools import lru_cache
from scripts.jyotish_engine import build_professional_report_reference_packet, cmd_full_reading
from scripts.pl9_full_data_export import REPORT_VERSION_FULL
from scripts.pl9_reader_export import _pl9_export_markdown_for_edition
from scripts.professional_report_reference import _export_args
from scripts.report_render.expression_paths_wiring import attach_engine_expression_paths
from tests.test_consult_card_full_source import _public_body
PUBLIC_REPORT_CASES = ("steve_jobs_1955_aa", "barack_obama_1961_aa")
@lru_cache(maxsize=len(PUBLIC_REPORT_CASES))
def public_chart_reports(case_id: str) -> tuple[dict, str, str]:
args = _export_args({**_public_body(case_id), "today": "2026-11-11", "target_year": 2026})
reading = cmd_full_reading(args)
packet = dict(build_professional_report_reference_packet(reading, args, []))
packet["report_version"] = REPORT_VERSION_FULL
# BUG-2296: as the report API does (professional_report_reference.build_professional_report_reference).
attach_engine_expression_paths(reading, packet)
chinese = _pl9_export_markdown_for_edition(packet, "full_data")
english_packet = deepcopy(packet)
english_packet["report_language"] = "en"
english = _pl9_export_markdown_for_edition(english_packet, "full_data")
return packet, chinese, english