test(pfs): lineage-pass edges covered; the unused _event_stated wrapper folds into _stating_sentence

This commit is contained in:
kert
2026-11-13 04:00:53 -05:00
parent a387a2fa73
commit 77fdc15ad7
2 changed files with 37 additions and 10 deletions

View File

@@ -1075,17 +1075,13 @@ _RVU_KINDS = frozenset(
_DIRECTIONAL = frozenset({"replaced_by", "replaces", "crosswalk"})
def _event_stated(bib: _Bib, e: Any) -> bool:
"""An FR lineage row stands only on a final rule's paragraph (never a
proposal), not a commenter's ("Comment:"), with a plain sentence naming
the code that reads as the event: no recap of another year's rule, no
hypothetical or request, no "we proposed"/"if this proposal"."""
return _stating_sentence(bib, e) is not None
def _stating_sentence(bib: _Bib, e: Any) -> str | None:
"""The sentence that states the FR lineage row *e* (``_event_stated``;
a telehealth-list row's whole paragraph), else ``None``."""
"""The sentence that states the FR lineage row *e* (a telehealth-list
row's whole paragraph), else ``None``. A row stands only on a final
rule's paragraph (never a proposal), not a commenter's ("Comment:"),
with a plain sentence naming the code that reads as the event: no recap
of another year's rule, no hypothetical or request, no "we
proposed"/"if this proposal"."""
from pfs.lineage import deletion_readings
from pfs.origin import _names, _plain
from pfs.rounds import _sentences

View File

@@ -2780,3 +2780,34 @@ def test_a_code_still_listed_later_was_not_deleted(home_fixture):
assert "lineage contradiction: 99418 is in the CY2024 RVU file (status I)" in {
r["reason"] for r in a.review
}
def test_lineage_pass_edges(home_fixture, monkeypatch, caplog):
con, store, family, _ask = home_fixture
# no codes, no RVU table: nothing to judge by
assert dos._rvu_years(con, []) == ({}, {}, None)
bare = duckdb.connect(":memory:")
assert dos._rvu_years(bare, ["99341"]) == ({}, {}, None)
class _Broken:
def execute(self, *a, **k):
raise RuntimeError("boom")
with pytest.raises(RuntimeError):
dos._rvu_years(_Broken(), ["99341"])
# an event from neither the FR nor the RVU file states nothing
write_events(
con,
"99341",
[EventRow("99341", 2023, "created", "", "", "", 0, 0, "cpt", True, "")],
)
assert "99341 was created for CY2023." not in _texts(
collect_facts(con, store, family), "event"
)
# an unreadable licensed book is no check, never an error
import pfs.guideline_facts as gf
monkeypatch.setattr(gf, "load_pages", lambda s, k: 1 / 0)
with caplog.at_level("WARNING", logger="pfs.dossier"):
assert dos._Bib(store).book_page("BOOK", "49") == ""
assert "book BOOK unreadable" in caplog.text