Skip to content

Commit e739655

Browse files
committed
Add tests for dual title+prefix and multi-conjunction chains
Covers two gaps flagged in review: a merged piece that's registered as both a title and a prefix ("freiherr"), and a chain with more than one non-contiguous conjunction bridging prefixes into the last name.
1 parent 3e14ea2 commit e739655

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

tests/test_conjunctions.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,3 +254,23 @@ def test_conjunction_prefix_merge_at_start_stays_first_name(self) -> None:
254254
hn = HumanName("and van Buren")
255255
self.m(hn.first, "and van", hn)
256256
self.m(hn.last, "Buren", hn)
257+
258+
def test_conjunction_bridges_word_that_is_both_title_and_prefix(self) -> None:
259+
# "freiherr" is registered as both a title and a prefix. When it sits
260+
# next to a conjunction, join_on_conjunctions() runs the is_title and
261+
# is_prefix checks independently (not elif), so the merged piece
262+
# ("freiherr und") is added to both constants sets. Confirms that
263+
# dual registration doesn't break the prefix-bridging into last.
264+
hn = HumanName("Fritz Freiherr und von Bar")
265+
self.m(hn.first, "Fritz", hn)
266+
self.m(hn.middle, "", hn)
267+
self.m(hn.last, "Freiherr und von Bar", hn)
268+
269+
def test_conjunction_bridges_prefix_chain_with_multiple_conjunctions(self) -> None:
270+
# Two separate conjunctions ("und" appearing twice, not contiguous)
271+
# each bridge their own pair of adjacent prefixes, so both merges
272+
# must register as prefixes for the whole chain to join into last.
273+
hn = HumanName("Alois von und zu und von Liechtenstein")
274+
self.m(hn.first, "Alois", hn)
275+
self.m(hn.middle, "", hn)
276+
self.m(hn.last, "von und zu und von Liechtenstein", hn)

0 commit comments

Comments
 (0)