import pytest from guardrails.validator_service import SequentialValidatorService validator_service = SequentialValidatorService() @pytest.mark.parametrize( "original, new_values, expected", [ # test behavior on blank fixes ("hello world", ["", "hello nick"], "nick"), ("hello world", ["", "hello world"], ""), # test behavior on non overlapping replacements ( """John is a shitty person who works at Anthropic on Claude, and lives in San Francisco""", [ """ is a shitty person who works at Anthropic on , and lives in """, """John is a ****** person who works at Anthropic on Claude, and lives in San Francisco""", ], """ is a ****** person who works at Anthropic on , and lives in """, ), # test behavior with lowercase ( """JOE is FUNNY and LIVES in NEW york""", [ """ is FUNNY and lives in """, """joe is funny and lives in new york""", ], """ is funny and lives in """, ), ( """JOHN lives IN SAN francisco""", [ """ lives in """, """john lives in san francisco""", ], """ lives in """, ), # (broken) test behavior with a word close to PERSON - seems to work!? ( """Parson is FUNNY and LIVES in NEW york""", [ """ is FUNNY and lives in """, """parson is funny and lives in new york""", ], """ is funny and lives in """, ), ], ) def test_merge(original, new_values, expected): print("testing", original, new_values, expected) res = validator_service.multi_merge(original, new_values) print("res", res) assert res == expected