1
+ import pytest
2
+
1
3
from langchain_core .prompts .chat import ChatPromptTemplate , MessagesPlaceholder
2
4
from langchain_core .prompts .pipeline import PipelinePromptTemplate
3
5
from langchain_core .prompts .prompt import PromptTemplate
4
6
7
+ # Suppress deprecation warnings for PipelinePromptTemplate since we're testing the
8
+ # deprecated functionality intentionally to ensure it still works correctly
9
+
5
10
11
+ @pytest .mark .filterwarnings (
12
+ "ignore:This class is deprecated"
13
+ ":langchain_core._api.deprecation.LangChainDeprecationWarning"
14
+ )
6
15
def test_get_input_variables () -> None :
7
16
prompt_a = PromptTemplate .from_template ("{foo}" )
8
17
prompt_b = PromptTemplate .from_template ("{bar}" )
@@ -12,6 +21,10 @@ def test_get_input_variables() -> None:
12
21
assert pipeline_prompt .input_variables == ["foo" ]
13
22
14
23
24
+ @pytest .mark .filterwarnings (
25
+ "ignore:This class is deprecated"
26
+ ":langchain_core._api.deprecation.LangChainDeprecationWarning"
27
+ )
15
28
def test_simple_pipeline () -> None :
16
29
prompt_a = PromptTemplate .from_template ("{foo}" )
17
30
prompt_b = PromptTemplate .from_template ("{bar}" )
@@ -22,6 +35,10 @@ def test_simple_pipeline() -> None:
22
35
assert output == "jim"
23
36
24
37
38
+ @pytest .mark .filterwarnings (
39
+ "ignore:This class is deprecated"
40
+ ":langchain_core._api.deprecation.LangChainDeprecationWarning"
41
+ )
25
42
def test_multi_variable_pipeline () -> None :
26
43
prompt_a = PromptTemplate .from_template ("{foo}" )
27
44
prompt_b = PromptTemplate .from_template ("okay {bar} {baz}" )
@@ -32,6 +49,10 @@ def test_multi_variable_pipeline() -> None:
32
49
assert output == "okay jim deep"
33
50
34
51
52
+ @pytest .mark .filterwarnings (
53
+ "ignore:This class is deprecated"
54
+ ":langchain_core._api.deprecation.LangChainDeprecationWarning"
55
+ )
35
56
async def test_partial_with_chat_prompts () -> None :
36
57
prompt_a = ChatPromptTemplate (
37
58
input_variables = ["foo" ], messages = [MessagesPlaceholder (variable_name = "foo" )]
0 commit comments