Fix every real lint finding and drop degenerate splice fragments
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
from ingestion.extract.page_map import pick_folio
|
||||
|
||||
|
||||
def test_single_candidate_is_the_folio():
|
||||
assert pick_folio([("101", 10.0)]) == 101
|
||||
|
||||
|
||||
def test_no_candidates_is_unrecoverable():
|
||||
assert pick_folio([]) is None
|
||||
|
||||
|
||||
def test_confirmed_riboflavin_subscript_conflict_resolved_by_size():
|
||||
# exact (text, size) pairs read from physical page 1243's header band:
|
||||
# the real folio "1244" (size 10.0, matching the rest of the running
|
||||
# header) and the "2" subscript from "Vitamin B2" (size 5.83), which
|
||||
# happens to fall in the same y<60 header band because the RIBOFLAVIN
|
||||
# title sits high on the page — see module docstring. Silently dropped
|
||||
# the whole monograph before this fix, confirmed via a whole-book
|
||||
# `cli validate` run and by rendering the page to an image.
|
||||
candidates = [("1244", 10.0), ("2", 5.83)]
|
||||
assert pick_folio(candidates) == 1244
|
||||
|
||||
|
||||
def test_genuine_same_size_conflict_still_returns_none():
|
||||
# two same-size digit-only candidates: real ambiguity, must not guess
|
||||
candidates = [("101", 10.0), ("205", 10.0)]
|
||||
assert pick_folio(candidates) is None
|
||||
Reference in New Issue
Block a user