from schemas import TurnUpdate class TestToneDelta: def test_default_is_zero(self): assert TurnUpdate().tone_delta == 0 def test_clamped_high(self): assert TurnUpdate(tone_delta=25).tone_delta == 10 def test_clamped_low(self): assert TurnUpdate(tone_delta=-25).tone_delta == -10 def test_in_range_untouched(self): assert TurnUpdate(tone_delta=-7).tone_delta == -7 class TestCruelQuote: def test_default_is_none(self): assert TurnUpdate().cruel_quote is None def test_stripped(self): assert TurnUpdate(cruel_quote=" you freak ").cruel_quote == "you freak" def test_truncated_to_120(self): q = "x" * 300 assert len(TurnUpdate(cruel_quote=q).cruel_quote) == 120 def test_empty_becomes_none(self): assert TurnUpdate(cruel_quote=" ").cruel_quote is None class TestExistingFieldsUnchanged: def test_affinity_delta_still_clamped(self): assert TurnUpdate(affinity_delta=20).affinity_delta == 8