Files
Jyotisha/tests/test_annual_motion_rows_2316.py
ClaudeandClaude Opus 5.5 defa105774 feat(annual): every annual named-yoga row, helper and interferer rows included, carries its own pair's computed contacts and motion changes for that year (BUG-2316)
Ports the astrologer's _row_motion_evidence (upstream 58f37ee5b). Stored as
indexes into the year's event list, so rows do not repeat hundreds of events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DbBXp2U3BH1SxwAGyhhbe1
2026-11-24 15:44:32 +08:00

50 lines
3.3 KiB
Python

"""BUG-2316: annual named-yoga rows, helper / mediator / interferer rows included, carry their motion evidence."""
from scripts.annual_tajika_pack import _tajika_condition_status_pack
from scripts.report_render import annual_motion
from scripts.transit_search import build_tajika_motion_timeline
def test_report_rows_bind_their_own_pair_contacts(monkeypatch, tmp_path):
monkeypatch.setenv('JYOTISH_ANNUAL_MOTION_CACHE_DIR', str(tmp_path))
request = dict(reference_date='2026-11-23T00:00:00', end_exclusive='2026-11-26T00:00:00', days=3, tz=0,
ayanamsa='lahiri', position_mode='apparent')
planets = build_tajika_motion_timeline(**request)['initial_positions']
pack = {'profile': {'target_year': 2026, 'input_hash': 'h', 'profile_hash': 'p'},
'solar_return': {'data': {}, 'tajika_motion': {'request_status': {'status': 'ready'}, 'request': request,
'named_yoga_inputs': planets}}}
packet = {'worksheets': {'timing_and_predictive_systems': {
'annual_tajika_pack': pack, 'annual_tajika_series': {'years': {'2026': pack}}}}}
annual_motion.attach_annual_motion(packet)
condition = pack['tajika_condition_status_pack']
timeline = condition['motion_timeline']
assert timeline['execution_status'] == 'executed'
pair_rows = [row for row in condition['rows'] if len(set(row.get('planets') or [])) == 2]
assert pair_rows
for row in pair_rows:
evidence = row['motion_evidence']
assert evidence['execution_status'] == 'executed'
assert evidence['named_yoga_perfection'] == 'not_adjudicated'
contacts = annual_motion.row_contacts(evidence, timeline)
assert len(contacts) == evidence['contact_count']
assert all(set(event['planets']) == set(row['planets']) for event in contacts)
assert evidence['contact_status'] == ('found_in_window' if contacts else 'not_found_in_window')
changes = annual_motion.expanded_row_motion_changes(row, timeline)
assert len(changes) == evidence['motion_change_count']
# The named-yoga field keeps the same rows and points at the one stored timeline.
named = pack['tajika_named_yogas']['data']
assert named['motion_timeline']['events_at'] == 'tajika_condition_status_pack.motion_timeline.events'
assert all(row['motion_evidence'].get('execution_status') for row in named['rows'])
def test_condition_pack_keeps_helper_and_interferer_roles_with_evidence():
evidence = {'execution_status': 'executed', 'contact_status': 'not_found_in_window', 'named_yoga_perfection': 'not_adjudicated'}
field = {'data': {'status': 'authority_ready', 'authority_ready': True, 'rows': [
{'named_yoga': 'Dutthotta-Daivira', 'authority_status': 'supported', 'planets': ['Mars', 'Venus'],
'helper_planet': 'Jupiter', 'helper_ithasala_pair': ['Jupiter', 'Venus'], 'motion_evidence': evidence},
{'named_yoga': 'Manahoo', 'authority_status': 'supported', 'planets': ['Sun', 'Jupiter'],
'interfering_planet': 'Mars', 'motion_evidence': evidence}]}}
rows = _tajika_condition_status_pack(field)['rows']
assert rows[0]['helper_planet'] == 'Jupiter' and rows[0]['helper_ithasala_pair'] == ['Jupiter', 'Venus']
assert rows[1]['interfering_planet'] == 'Mars'
assert all(row['motion_evidence'] == evidence for row in rows)