mirror of
https://github.com/migatu/astrololo.git
synced 2026-07-14 13:34:38 +00:00
82809665ff
- abbreviations.py: słownik skrót -> pełna nazwa (z SIGNIFICATORS KEY, built-in) + expand(): [Su in [Tau -> "Sun in Taurus", [Sa in 6th H. -> "...6th house", affl. -> afflicted itd. - significators: każda próbka ma pole "expanded" (postać czytelna); hartowanie filtra szumu (efekty zastępcze x/?/-, wiersze *MARKER, legendy/nagłówki). - prezentacja /interpret: pokazuje rozwiniętą postać, surowy skrót w tooltipie. Zweryfikowano na realnym main_base.xlsx: "[Sa or [Ma in the 5th H." -> "Saturn or Mars in the 5th house". 9 testów przechodzi (w tym test_abbreviations). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
49 lines
2.1 KiB
Python
49 lines
2.1 KiB
Python
"""Testy mostu obliczenia → sygnifikatory → wyszukiwanie (bez efemeryd/HTTP)."""
|
|
from app.engine.models import DEFAULT_OBJECTS
|
|
from app.significators import PLANET_ABBR, _ordinal, build_report
|
|
|
|
|
|
class FakeData:
|
|
def __init__(self, rows_by_value: dict) -> None:
|
|
self.rows_by_value = rows_by_value
|
|
|
|
def search(self, key, value, exact, limit, fields=None) -> dict:
|
|
rows = self.rows_by_value.get(value, [])
|
|
return {"provider": "fake", "total": len(rows), "rows": rows}
|
|
|
|
|
|
def test_sign_and_house_facets():
|
|
positions = [{"name": "Sun", "sign": "Taurus", "direction": "D", "house": 11}]
|
|
data = FakeData({"[Su": [
|
|
{"significator": "[Su in [Tau", "actioneffect": "efekt znak"}, # faseta znak
|
|
{"significator": "[Su in 11th H.", "actioneffect": "efekt dom"}, # faseta dom
|
|
{"significator": "[Su in [Vir", "actioneffect": "inny"}, # żadna
|
|
{"significator": "[Su in [Tau", "actioneffect": "nan"}, # szum
|
|
]})
|
|
item = build_report(positions, data)["objects"][0]
|
|
assert item["object"] == "Sun" and item["house"] == 11
|
|
facets = {f["type"]: f for f in item["facets"]}
|
|
assert facets["sign"]["count"] == 1
|
|
assert facets["sign"]["samples"][0]["effect"] == "efekt znak"
|
|
assert facets["sign"]["samples"][0]["expanded"] == "Sun in Taurus" # rozwinięcie skrótu
|
|
assert facets["house"]["count"] == 1
|
|
assert facets["house"]["token"] == "11th H."
|
|
assert facets["house"]["samples"][0]["effect"] == "efekt dom"
|
|
|
|
|
|
def test_no_house_facet_when_house_missing():
|
|
positions = [{"name": "Mars", "sign": "Scorpio", "direction": "Rx"}]
|
|
data = FakeData({"[Ma": [{"significator": "[Ma in [Sco", "actioneffect": "eff"}]})
|
|
types = [f["type"] for f in build_report(positions, data)["objects"][0]["facets"]]
|
|
assert "sign" in types and "house" not in types
|
|
|
|
|
|
def test_ordinal():
|
|
assert _ordinal(1) == "1st" and _ordinal(2) == "2nd" and _ordinal(3) == "3rd"
|
|
assert _ordinal(4) == "4th" and _ordinal(11) == "11th" and _ordinal(12) == "12th"
|
|
|
|
|
|
def test_planet_abbr_covers_all_default_objects():
|
|
for o in DEFAULT_OBJECTS:
|
|
assert o in PLANET_ABBR
|