From 77fdc15ad796b4736fc653addfce986fd8a1583f Mon Sep 17 00:00:00 2001 From: kert Date: Fri, 13 Nov 2026 04:00:53 -0500 Subject: [PATCH] test(pfs): lineage-pass edges covered; the unused _event_stated wrapper folds into _stating_sentence --- src/pfs/dossier.py | 16 ++++++---------- tests/pfs/test_dossier.py | 31 +++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/src/pfs/dossier.py b/src/pfs/dossier.py index 0a1cc04..7ea3938 100644 --- a/src/pfs/dossier.py +++ b/src/pfs/dossier.py @@ -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 diff --git a/tests/pfs/test_dossier.py b/tests/pfs/test_dossier.py index 32a7898..afe6b6e 100644 --- a/tests/pfs/test_dossier.py +++ b/tests/pfs/test_dossier.py @@ -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