Skip to content

Commit 7a4fa38

Browse files
derek73claude
andcommitted
test(#558): pin the stopping title's dropped peel pick
The one line of the #558 diff no test reached: a resumed pass drops the pick the previous walk made at the title the chain then took. No default title is an ambiguous acronym, so the row configures one ('ma'). Without the drop, 'John Smith Ma. PhD Jr.' keeps its fields and reports 'suffix-or-name' on the title 'Ma.'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 74301f4 commit 7a4fa38

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

‎tests/v2/pipeline/test_pieces.py‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
import pytest
1313

14-
from nameparser import parse
14+
from nameparser import Parser, parse
1515
from nameparser._lexicon import Lexicon, _normalize
1616
from nameparser._pipeline import STAGES
1717
from nameparser._pipeline._assign import assign
@@ -822,3 +822,19 @@ def test_anchor_in_reach_never_hides_an_anchor() -> None:
822822
failures = _reach_failures(sorted(texts))
823823
assert not failures, (f"{len(failures)} anchored member(s) the "
824824
f"reach test hides:\n" + "\n".join(failures[:15]))
825+
826+
827+
def test_a_title_the_fixed_point_splices_out_keeps_no_peel_pick() -> None:
828+
# tail_reading's resumed pass (#558) carries the picks of the walk
829+
# before it, and that walk STOPPED at the title the chain then took:
830+
# where the title is also an ambiguous acronym the stop was a pick,
831+
# and a fresh walk over the spliced pieces never meets the word.
832+
# No default title is an ambiguous acronym, so a caller's lexicon is
833+
# the only way here. Recorded negative control (2026-10-01): with
834+
# the drop removed, this reads the same fields and reports
835+
# 'suffix-or-name' on 'Ma.', a word the parse took as a title.
836+
parser = Parser(lexicon=Lexicon.default().add(titles={"ma"}))
837+
name = parser.parse("John Smith Ma. PhD Jr.")
838+
assert (name.title, name.given, name.family, name.suffix) == (
839+
"Ma.", "John", "Smith", "PhD Jr.")
840+
assert name.ambiguities == ()

0 commit comments

Comments
 (0)