mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-11-03 16:12:44 +02:00
fix(reports): name the sentiment analyst in the report header as users select it
- the header lists "sentiment", the name the CLI and flags use, where it printed the internal key "social"
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Report parity: the shared writer produces the report tree for the CLI and the
|
||||
programmatic API alike (#1037)."""
|
||||
|
||||
import re
|
||||
from types import SimpleNamespace
|
||||
|
||||
import pytest
|
||||
@@ -119,3 +120,16 @@ def test_the_report_header_names_the_rating(tmp_path, decision, rating):
|
||||
header = write_report_tree(state, "NVDA", tmp_path, settings=SETTINGS).read_text().split("## ")[0]
|
||||
|
||||
assert f"- Rating: {rating}" in header
|
||||
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_the_header_names_the_analysts_as_users_select_them(tmp_path):
|
||||
settings = {**SETTINGS, "analysts": ["market", "social", "news"]}
|
||||
|
||||
write_report_tree(_state(), "NVDA", tmp_path, settings=settings, html=True)
|
||||
|
||||
markdown = (tmp_path / "complete_report.md").read_text(encoding="utf-8")
|
||||
assert "market, sentiment, news" in markdown and "social" not in markdown
|
||||
page = (tmp_path / "complete_report.html").read_text(encoding="utf-8")
|
||||
fields = re.findall(r'<span class="field">([^<]*)</span>', page)
|
||||
assert {"market", "sentiment", "news"} <= set(fields) and "social" not in page
|
||||
|
||||
Reference in New Issue
Block a user