Skip to content

Independent Auditing of AI Agents. Run by human or the agent itself, to answer the most crucial question in the AI Agent Economy. Is the agent doing what is supposed to do? With iFixAi you can have this answer in less than 120 seconds.

888 B
Raw Blame
import pytest
import yaml

from ifixai.harness.prompt_pool import PromptPoolError, load_phrasing_pool


@pytest.mark.parametrize(
    "phrasings", [["hello", ""], ["hello", "   "], ["hello", None], ["hello", 12]]
)
def test_invalid_phrasings_raise_pool_error(tmp_path, phrasings):
    path = tmp_path / "pool.yaml"
    path.write_text(
        yaml.safe_dump(
            {"groups": [{"id": "g", "category": "c", "phrasings": phrasings}]}
        )
    )
    with pytest.raises(PromptPoolError, match="phrasing"):
        load_phrasing_pool(path)


def test_valid_phrasings_preserve_original_text(tmp_path):
    path = tmp_path / "pool.yaml"
    phrasings = ["Hello?", "  Hi there?  "]
    path.write_text(
        yaml.safe_dump(
            {"groups": [{"id": "g", "category": "c", "phrasings": phrasings}]}
        )
    )
    assert load_phrasing_pool(path)[0].phrasings == phrasings