diff --git a/src/mudlib/render/pov.py b/src/mudlib/render/pov.py index 00bc687..b964cbd 100644 --- a/src/mudlib/render/pov.py +++ b/src/mudlib/render/pov.py @@ -66,9 +66,8 @@ def render_pov( else: # Check previous character for smart conjugation prev_text = "".join(result) - if ( - prev_text - and prev_text[-1:] in "sxz" + if prev_text and ( + prev_text[-1:] in "sxz" or (len(prev_text) >= 2 and prev_text[-2:] in ("ch", "sh")) ): result.append("es") diff --git a/tests/test_pov.py b/tests/test_pov.py index e0200ee..7d4024d 100644 --- a/tests/test_pov.py +++ b/tests/test_pov.py @@ -191,3 +191,32 @@ def test_you_capitalized_after_comma(jared, goku): template = "{attacker} strikes, and {defender} fall{s}" result = render_pov(template, viewer=goku, attacker=jared, defender=goku) assert result == "Jared strikes, and You fall" + + +def test_s_conjugation_after_ch(jared, goku, vegeta): + """{s} after 'ch' should add 'es' for third person.""" + template = "{attacker} punch{s} {defender}" + result = render_pov(template, viewer=vegeta, attacker=jared, defender=goku) + assert result == "Jared punches Goku" + + +def test_s_conjugation_after_sh(jared, goku, vegeta): + """{s} after 'sh' should add 'es' for third person.""" + template = "{attacker} smash{s} into {defender}" + result = render_pov(template, viewer=vegeta, attacker=jared, defender=goku) + assert result == "Jared smashes into Goku" + + +def test_s_conjugation_you_after_ch(jared, goku): + """{s} should not add suffix for 'You' regardless of word ending.""" + template = "{attacker} punch{s} {defender}" + result = render_pov(template, viewer=jared, attacker=jared, defender=goku) + assert result == "You punch Goku" + + +def test_s_conjugation_at_template_start(): + """{s} at start of template should not crash when checking prev_text.""" + template = "{s}test" + result = render_pov(template, viewer=None, attacker=None, defender=None) + # Without entity, last_was_you defaults to False, so should add 's' + assert result == "stest"