fix(rectification): honor persisted probe focus
This commit is contained in:
@@ -410,6 +410,45 @@ class EventProbesTest(unittest.TestCase):
|
||||
self.assertEqual(row["source"], "dasha_boundary")
|
||||
self.assertGreater(row["information_gain"], 0)
|
||||
|
||||
def test_relationship_boundary_starts_at_adult_age_band(self) -> None:
|
||||
from unittest.mock import patch
|
||||
|
||||
from scripts.rectification import event_probes as probes_mod
|
||||
|
||||
built = {
|
||||
"static_contexts": [
|
||||
_context("05:13", d4_asc=1, sun_house=4, sun_varga_sign=3, d9_asc=1, moon=100.0),
|
||||
_context("05:40", d4_asc=1, sun_house=4, sun_varga_sign=3, d9_asc=2, moon=101.0),
|
||||
]
|
||||
}
|
||||
|
||||
def fake_vim(_birth_date: str, moon: float, _lo: int, _hi: int) -> list[int]:
|
||||
return [2003, 2019] if moon <= 100.0 else [2002, 2018]
|
||||
|
||||
def fake_narayana(_asc: int, planets: dict, _birth_date: str, _lo: int, _hi: int) -> list[int]:
|
||||
moon = float(planets.get("Moon") or 0)
|
||||
return [2003, 2019] if moon <= 100.0 else [2002, 2018]
|
||||
|
||||
def fake_score(context: dict, *, birth_date: str, domain: str, year: int) -> dict:
|
||||
del birth_date, domain, year
|
||||
return {
|
||||
"rule_ids": ["vim_md_domain_house"]
|
||||
if probes_mod._context_time(context) == "05:13"
|
||||
else ["no_domain_activation"]
|
||||
}
|
||||
|
||||
with (
|
||||
patch.object(probes_mod, "_vim_start_years", side_effect=fake_vim),
|
||||
patch.object(probes_mod, "_narayana_start_years", side_effect=fake_narayana),
|
||||
patch.object(probes_mod, "_score_year", side_effect=fake_score),
|
||||
):
|
||||
probes = _probes(_request(), built, ["05:13", "05:40"], "05:13")
|
||||
|
||||
relationship = [item for item in probes if item["domain"] == "relationship"]
|
||||
self.assertTrue(relationship)
|
||||
self.assertTrue(all(item["year"] >= 2018 for item in relationship))
|
||||
self.assertFalse(any(item["year"] in {2002, 2003} for item in relationship))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user