fix(llm): match dossier and valuation tests to current families
CCM is curated, and the book has no planned family left, so the 404 status test injects one. 99213 and 99214 expand to the office-visit family; the concurrency test counts the asked code's own rows.
This commit is contained in:
@@ -581,8 +581,9 @@ class TestConcurrentChats:
|
||||
con.execute("CREATE SCHEMA pfs")
|
||||
con.execute(f"CREATE TABLE pfs.rvu ({RVU_COLS})")
|
||||
con.execute(f"CREATE TABLE pfs.rvu_proposed ({PROPOSED_COLS})")
|
||||
# two unfamilied codes with different row counts, so a swapped
|
||||
# result set is visible as a wrong count
|
||||
# Two codes in one family, with different row counts. A question
|
||||
# names one code and the family comes with it; the asked code's
|
||||
# own rows are what shows a swapped result set.
|
||||
con.executemany(
|
||||
"INSERT INTO pfs.rvu VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
|
||||
[
|
||||
@@ -630,15 +631,17 @@ class TestConcurrentChats:
|
||||
opens.append(a)
|
||||
return real_connect(*a, **kw)
|
||||
|
||||
expected = {"99213": 1, "99214": 3}
|
||||
# 99214 is inserted for three years; a year with no pfs.rules
|
||||
# entry is not priced, so the asked code contributes two rows.
|
||||
expected = {"99213": 1, "99214": 2}
|
||||
questions = ["What does 99213 pay?", "What does 99214 pay?"]
|
||||
|
||||
def one(i):
|
||||
q = questions[i % 2]
|
||||
want = "99213" if i % 2 == 0 else "99214"
|
||||
ev = valuation_evidence(q, cfg)
|
||||
assert ev is not None, "valuation dropped under concurrency"
|
||||
(code,) = ev.codes
|
||||
return code, len(ev.rows)
|
||||
return want, sum(1 for r in ev.rows if r.code == want)
|
||||
|
||||
with patch("llm.evidence.duckdb.connect", counting_connect):
|
||||
with ThreadPoolExecutor(max_workers=8) as pool:
|
||||
|
||||
@@ -261,11 +261,18 @@ def test_unknown_section_404(client):
|
||||
|
||||
|
||||
def test_no_dossier_404_with_status(client, monkeypatch):
|
||||
r = client.get(URL.format("header"), params={"family": "CCM"})
|
||||
# Every book family is curated now, so "planned" has to be injected.
|
||||
from pfs.book import load_book
|
||||
|
||||
real_book = load_book()
|
||||
monkeypatch.setattr(
|
||||
"pfs.book.load_book", lambda *a, **k: {**real_book, "ZZZ-PLAN": object()}
|
||||
)
|
||||
r = client.get(URL.format("header"), params={"family": "ZZZ-PLAN"})
|
||||
assert r.status_code == 404
|
||||
d = r.json()["detail"]
|
||||
assert d["status"] == "planned" and d["family"] == "CCM"
|
||||
assert d["message"] == "No dossier is built for CCM yet."
|
||||
assert d["status"] == "planned" and d["family"] == "ZZZ-PLAN"
|
||||
assert d["message"] == "No dossier is built for ZZZ-PLAN yet."
|
||||
|
||||
from pfs.curated import load_curated
|
||||
|
||||
@@ -380,7 +387,7 @@ def test_fact_endpoint(client):
|
||||
assert r.status_code == 404 and r.json()["detail"]["message"] == "unknown fact"
|
||||
assert client.get("/api/policy/fact", params={**HV, "id": "x"}).status_code == 422
|
||||
r = client.get("/api/policy/fact", params={"family": "CCM", "id": "F1"})
|
||||
assert r.status_code == 404 and r.json()["detail"]["status"] == "planned"
|
||||
assert r.status_code == 404 and r.json()["detail"]["status"] == "curated"
|
||||
|
||||
|
||||
def test_load_slice_matches_http(replica, client):
|
||||
|
||||
Reference in New Issue
Block a user