Skip to content

Commit 9b624a7

Browse files
authored
test(core): suppress deprecation warnings in PipelinePromptTemplate (#33102)
We're intentionally testing this still so as not to regress. Reduce warning noise.
1 parent c60c5a9 commit 9b624a7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

libs/core/tests/unit_tests/prompts/test_pipeline_prompt.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1+
import pytest
2+
13
from langchain_core.prompts.chat import ChatPromptTemplate, MessagesPlaceholder
24
from langchain_core.prompts.pipeline import PipelinePromptTemplate
35
from langchain_core.prompts.prompt import PromptTemplate
46

7+
# Suppress deprecation warnings for PipelinePromptTemplate since we're testing the
8+
# deprecated functionality intentionally to ensure it still works correctly
9+
510

11+
@pytest.mark.filterwarnings(
12+
"ignore:This class is deprecated"
13+
":langchain_core._api.deprecation.LangChainDeprecationWarning"
14+
)
615
def test_get_input_variables() -> None:
716
prompt_a = PromptTemplate.from_template("{foo}")
817
prompt_b = PromptTemplate.from_template("{bar}")
@@ -12,6 +21,10 @@ def test_get_input_variables() -> None:
1221
assert pipeline_prompt.input_variables == ["foo"]
1322

1423

24+
@pytest.mark.filterwarnings(
25+
"ignore:This class is deprecated"
26+
":langchain_core._api.deprecation.LangChainDeprecationWarning"
27+
)
1528
def test_simple_pipeline() -> None:
1629
prompt_a = PromptTemplate.from_template("{foo}")
1730
prompt_b = PromptTemplate.from_template("{bar}")
@@ -22,6 +35,10 @@ def test_simple_pipeline() -> None:
2235
assert output == "jim"
2336

2437

38+
@pytest.mark.filterwarnings(
39+
"ignore:This class is deprecated"
40+
":langchain_core._api.deprecation.LangChainDeprecationWarning"
41+
)
2542
def test_multi_variable_pipeline() -> None:
2643
prompt_a = PromptTemplate.from_template("{foo}")
2744
prompt_b = PromptTemplate.from_template("okay {bar} {baz}")
@@ -32,6 +49,10 @@ def test_multi_variable_pipeline() -> None:
3249
assert output == "okay jim deep"
3350

3451

52+
@pytest.mark.filterwarnings(
53+
"ignore:This class is deprecated"
54+
":langchain_core._api.deprecation.LangChainDeprecationWarning"
55+
)
3556
async def test_partial_with_chat_prompts() -> None:
3657
prompt_a = ChatPromptTemplate(
3758
input_variables=["foo"], messages=[MessagesPlaceholder(variable_name="foo")]

0 commit comments

Comments
 (0)