"""Test our hacky fix to the GPT 3.5 Turbo token repetition rejection bug."""

from promptgame.gameui.utils import remove_gpt_token_runs


def test_gpt_35_repeat_hack() -> None:
    assert f"b{' a' * 199} b" == remove_gpt_token_runs(f"b{' a' * 260} b")
    assert f"b{' a' * 199} b" == remove_gpt_token_runs(f"b{' a' * 200} b")
    assert f"b{' a' * 199} b" == remove_gpt_token_runs(f"b{' a' * 199} b")
    assert f"b{' a' * 42} b" == remove_gpt_token_runs(f"b{' a' * 42} b")
