@@ -223,3 +223,54 @@ def test_conjunction_in_an_address_with_a_first_name_title(self) -> None:
223223 def test_name_is_conjunctions (self ) -> None :
224224 hn = HumanName ("e and e" )
225225 self .m (hn .first , "e and e" , hn )
226+
227+ def test_conjunction_bridges_prefix_chain (self ) -> None :
228+ # "von" and "zu" are both prefixes, but "und" between them is only a
229+ # conjunction. join_on_conjunctions() merges "von und zu" into one
230+ # piece before the prefix-joining step runs, so without registering
231+ # that merged piece as a prefix too, it's stranded in the middle name
232+ # instead of joining to the last name. See German nobility styles
233+ # like "von und zu".
234+ hn = HumanName ("Alois von und zu Liechtenstein" )
235+ self .m (hn .first , "Alois" , hn )
236+ self .m (hn .middle , "" , hn )
237+ self .m (hn .last , "von und zu Liechtenstein" , hn )
238+
239+ def test_conjunction_bridges_prefix_chain_with_leading_title (self ) -> None :
240+ # Same bridging, but with extra prefix words on both sides of the
241+ # conjunction and a leading title-like word ("Freiherrin") that is
242+ # itself a prefix, confirming the chain still joins fully into last.
243+ hn = HumanName ("Annette Charlotte Freiherrin von und zu der Tann-Rathsamhausen" )
244+ self .m (hn .first , "Annette" , hn )
245+ self .m (hn .middle , "Charlotte" , hn )
246+ self .m (hn .last , "Freiherrin von und zu der Tann-Rathsamhausen" , hn )
247+
248+ def test_conjunction_prefix_merge_at_start_stays_first_name (self ) -> None :
249+ # Guards the i == 0 branch of the same fix: when the conjunction is
250+ # merged with a following prefix at the very start of the name, the
251+ # existing leading-prefix rule (a lone prefix opening the name is
252+ # treated as part of the first name, not joined to last) must still
253+ # apply to the merged piece.
254+ hn = HumanName ("and van Buren" )
255+ self .m (hn .first , "and van" , hn )
256+ 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