You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
# backend/tests/test_api_research.py
|
|
def test_research_report(client):
|
|
r = client.get("/api/research/report").json()
|
|
assert [c["n"] for c in r["counts"]] == [3, 5, 2]
|
|
assert len(r["cross"]) == 3
|
|
assert "추론(inference)" in r["synthesis"]
|
|
assert "교차 확인을 권해요" in r["note"]
|
|
|
|
|
|
def test_research_chart(client):
|
|
c = client.get("/api/research/chart").json()
|
|
assert len(c["bars"]) == 6
|
|
last = c["bars"][-1]
|
|
assert last["forecast"] is True and last["v"] == 412
|
|
assert "28.9%" in c["insight"] and "412억(±9%)" in c["insight"]
|
|
|
|
|
|
def test_research_home(client):
|
|
h = client.get("/api/research/home").json()
|
|
assert len(h["collections"]) == 3 and len(h["sources"]) == 5
|
|
assert len(h["prompts"]) == 3
|
|
s1 = next(x for x in h["sources"] if x["id"] == "s1")
|
|
assert s1["from"] == "산업연구원 · PDF 48p" # alias
|
|
|
|
|
|
def test_research_qa_seed(client):
|
|
qa = client.get("/api/research/qa").json()
|
|
assert qa["q"].startswith("유모차") and len(qa["refs"]) == 2
|