The "pie" indicator group was removed in v0.2 when portfolio composition moved to live Trading 212 sourcing (see the v0.2 note in config/portfolio.toml). The test wasn't updated at the time. Suite now runs cleanly: 199 passed, 5 skipped, 0 failed.
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""default.toml and portfolio.toml must load cleanly into the expected shapes."""
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
pytest.importorskip("pydantic_settings")
|
|
|
|
from pathlib import Path
|
|
|
|
from app.config import load_feeds, load_groups, load_presets
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
DEFAULT = ROOT / "config" / "default.toml"
|
|
PORTFOLIO = ROOT / "config" / "portfolio.toml"
|
|
|
|
|
|
def test_default_groups_present():
|
|
g = load_groups(DEFAULT, PORTFOLIO)
|
|
# "pie" was removed in v0.2 when the portfolio composition moved to
|
|
# live Trading 212 sourcing (see config/portfolio.toml header).
|
|
for expected in ("equity", "mag7", "rates", "macro", "commodities", "fx"):
|
|
assert expected in g, f"missing group: {expected}"
|
|
# Every item is a 3-tuple of strings.
|
|
for items in g.values():
|
|
for sym, lab, note in items:
|
|
assert isinstance(sym, str) and sym
|
|
assert isinstance(lab, str)
|
|
assert isinstance(note, str)
|
|
|
|
|
|
def test_default_feeds_present():
|
|
f = load_feeds(DEFAULT, PORTFOLIO)
|
|
for cat in ("markets", "world", "energy", "asia"):
|
|
assert cat in f, f"missing feed category: {cat}"
|
|
assert all(name and url for name, url in f[cat])
|
|
|
|
|
|
def test_presets_thesis_present():
|
|
p = load_presets(DEFAULT, PORTFOLIO)
|
|
assert "thesis" in p
|
|
assert "hormuz" in p["thesis"]
|