|
1 | 1 | """Unit tests for prompt and instructions parsing.""" |
2 | 2 |
|
3 | 3 | from string import Template |
4 | | -from unittest import mock |
5 | 4 |
|
6 | 5 | import pytest |
7 | 6 | from pydantic import BaseModel, Field |
@@ -232,31 +231,6 @@ def test_substitute_constants(prompt_str, final_prompt): |
232 | 231 | assert prompt.source == final_prompt |
233 | 232 |
|
234 | 233 |
|
235 | | -# TODO: Deprecate when we can confirm migration off the old, non-namespaced standard |
236 | | -@pytest.mark.parametrize( |
237 | | - "text, is_old_schema", |
238 | | - [ |
239 | | - (RAIL_WITH_OLD_CONSTANT_SCHEMA, True), # Test with a single match |
240 | | - ( |
241 | | - RAIL_WITH_FORMAT_INSTRUCTIONS, |
242 | | - False, |
243 | | - ), # Test with no matches/correct namespacing |
244 | | - ], |
245 | | -) |
246 | | -def test_uses_old_constant_schema(text, is_old_schema): |
247 | | - with mock.patch("warnings.warn") as warn_mock: |
248 | | - guard = gd.Guard.from_rail_string(text) |
249 | | - assert guard.prompt.uses_old_constant_schema(text) == is_old_schema |
250 | | - if is_old_schema: |
251 | | - # we only check for the warning when we have an older schema |
252 | | - warn_mock.assert_called_once_with( |
253 | | - """It appears that you are using an old schema for gaurdrails\ |
254 | | - variables, follow the new namespaced convention documented here:\ |
255 | | - https://docs.guardrailsai.com/0-2-migration/\ |
256 | | -""" |
257 | | - ) |
258 | | - |
259 | | - |
260 | 234 | class TestResponse(BaseModel): |
261 | 235 | grade: int = Field(description="The grade of the response") |
262 | 236 |
|
|
0 commit comments