Skip to content

Commit 45ceb80

Browse files
derek73claude
andcommitted
tests: add non-ASCII title normalization and variation tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 177cc48 commit 45ceb80

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

tests/test_titles.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,36 @@ def test_2_same_prefixes_in_the_name(self) -> None:
239239
self.m(hh.first, "Vincent", hh)
240240
self.m(hh.middle, "van Gogh", hh)
241241
self.m(hh.last, "van Beethoven", hh)
242+
243+
# Non-ASCII title normalization — confirm diacritic titles survive
244+
# the lowercase lookup path end-to-end.
245+
246+
def test_señora_non_ascii_title(self) -> None:
247+
hn = HumanName("Señora María García")
248+
self.m(hn.title, "Señora", hn)
249+
self.m(hn.first, "María", hn)
250+
self.m(hn.last, "García", hn)
251+
252+
def test_señora_lowercase_non_ascii_title(self) -> None:
253+
hn = HumanName("señora María García")
254+
self.m(hn.title, "señora", hn)
255+
self.m(hn.first, "María", hn)
256+
self.m(hn.last, "García", hn)
257+
258+
def test_frøken_non_ascii_title(self) -> None:
259+
hn = HumanName("Frøken Jensen")
260+
self.m(hn.title, "Frøken", hn)
261+
self.m(hn.first, "", hn)
262+
self.m(hn.last, "Jensen", hn)
263+
264+
def test_herr_title_not_first_name(self) -> None:
265+
hn = HumanName("Herr Schmidt")
266+
self.m(hn.title, "Herr", hn)
267+
self.m(hn.first, "", hn)
268+
self.m(hn.last, "Schmidt", hn)
269+
270+
def test_herr_title_with_first_name(self) -> None:
271+
hn = HumanName("Herr Klaus Schmidt")
272+
self.m(hn.title, "Herr", hn)
273+
self.m(hn.first, "Klaus", hn)
274+
self.m(hn.last, "Schmidt", hn)

tests/test_variations.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,13 @@
178178
"U.S. District Judge Marc Thomas Treadwell",
179179
"Dra. Andréia da Silva",
180180
"Srta. Andréia da Silva",
181+
"Herr Klaus Schmidt",
182+
"Frau Anna Müller",
183+
"Monsieur Jean Dupont",
184+
"Señor Carlos García",
185+
"Señora María García",
186+
"Signor Marco Rossi",
187+
"Mevrouw Anna de Vries",
181188

182189
)
183190

0 commit comments

Comments
 (0)