5
5
from arxiv_mcp_server .prompts .handlers import list_prompts , get_prompt
6
6
from mcp .types import GetPromptResult , PromptMessage , TextContent
7
7
8
+
8
9
@pytest .mark .asyncio
9
10
async def test_list_prompts ():
10
11
"""Test listing available prompts."""
11
12
prompts = await list_prompts ()
12
13
assert len (prompts ) == 1
13
-
14
+
14
15
prompt_names = {p .name for p in prompts }
15
16
expected_names = {"deep-paper-analysis" }
16
17
assert prompt_names == expected_names
17
18
19
+
18
20
@pytest .mark .asyncio
19
21
async def test_get_paper_analysis_prompt ():
20
22
"""Test getting paper analysis prompt."""
21
- result = await get_prompt (
22
- "deep-paper-analysis" ,
23
- {"paper_id" : "2401.00123" }
24
- )
25
-
23
+ result = await get_prompt ("deep-paper-analysis" , {"paper_id" : "2401.00123" })
24
+
26
25
assert isinstance (result , GetPromptResult )
27
26
assert len (result .messages ) == 1
28
27
message = result .messages [0 ]
29
-
28
+
30
29
assert isinstance (message , PromptMessage )
31
30
assert message .role == "user"
32
31
assert isinstance (message .content , TextContent )
33
32
assert "2401.00123" in message .content .text
34
33
34
+
35
35
@pytest .mark .asyncio
36
36
async def test_get_prompt_with_invalid_name ():
37
37
"""Test getting prompt with invalid name."""
38
38
with pytest .raises (ValueError , match = "Prompt not found" ):
39
39
await get_prompt ("invalid-prompt" , {})
40
40
41
+
41
42
@pytest .mark .asyncio
42
43
async def test_get_prompt_with_no_arguments ():
43
44
"""Test getting prompt with no arguments."""
44
45
with pytest .raises (ValueError , match = "No arguments provided" ):
45
46
await get_prompt ("deep-paper-analysis" , None )
46
47
48
+
47
49
@pytest .mark .asyncio
48
50
async def test_get_prompt_with_missing_required_argument ():
49
51
"""Test getting prompt with missing required argument."""
50
52
with pytest .raises (ValueError , match = "Missing required argument" ):
51
- await get_prompt ("deep-paper-analysis" , {})
53
+ await get_prompt ("deep-paper-analysis" , {})
0 commit comments