Skip to content

Commit b8a9252

Browse files
committed
Give the spaced-honorific test its missing control (#308)
test_ja_does_not_divide_a_spaced_surname_under_an_honorific asserted that 佐藤 氏 keeps family 佐藤, but nothing in it showed the pack WOULD divide 佐藤 otherwise -- it passed vacuously for any reason the segmenter went unconsulted, and the contrast is what the doc sentence it supports rests on. Assert the bare division too (佐 + 藤, 田 + 中, 鈴 + 木, 中 + 村), and add 中村 教授 so the four cases the prose now cites as the measured price of this rule are the four the test runs. The comment's "the writer drew this boundary: 佐藤 is a unit" goes with them, for the reason the previous commit gives.
1 parent 2189401 commit b8a9252

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

tests/v2/test_locales.py

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -485,16 +485,27 @@ def test_ja_divides_a_glued_name_carrying_an_honorific() -> None:
485485

486486
@_needs_ja
487487
def test_ja_does_not_divide_a_spaced_surname_under_an_honorific() -> None:
488-
# The writer drew this boundary: 佐藤 is a unit, and the
489-
# honorific beside it says nothing about where 佐藤 divides.
490-
# Only a tail this stage MANUFACTURED is exempt from the
491-
# neighbour test -- a glued honorific means no boundary was
492-
# drawn anywhere, a spaced one means one was.
488+
# A spaced honorific is a neighbour, and the segmenter is asked
489+
# only where an UNDIVIDED name divides, so it is never consulted
490+
# here. Only a tail this stage MANUFACTURED is exempt -- a glued
491+
# honorific means no boundary was typed anywhere, a spaced one
492+
# means one was, and by position a spaced honorific cannot be told
493+
# apart from a spaced name element besides.
494+
# The bare control is what makes any of that load-bearing: without
495+
# it the assertions pass vacuously, for any reason at all that the
496+
# segmenter went unconsulted. Each family name here DOES divide
497+
# standing alone, so the honorific is what stopped it -- and these
498+
# four are the measured price of counting spaced honorifics, paid
499+
# to decline the one division 山田太郎 様 (the test above).
493500
p = _PACKED["ja"]
494-
for name, family in (("佐藤 氏", "佐藤"), ("田中 様", "田中"),
495-
("鈴木 先生", "鈴木")):
501+
for name, family, divided in (("佐藤 氏", "佐藤", ("佐", "藤")),
502+
("田中 様", "田中", ("田", "中")),
503+
("鈴木 先生", "鈴木", ("鈴", "木")),
504+
("中村 教授", "中村", ("中", "村"))):
496505
n = p.parse(name)
497506
assert (n.family, n.given) == (family, ""), name
507+
bare = p.parse(family)
508+
assert (bare.family, bare.given) == divided, family
498509

499510

500511
@_needs_ja

0 commit comments

Comments
 (0)