Spaces:
Running
Running
Jeremiah Lowin commited on
Commit ·
43fa1ab
1
Parent(s): 873479e
Fix typing inference issue
Browse files
tests/prompts/test_prompt_manager.py
CHANGED
|
@@ -5,7 +5,7 @@ import pytest
|
|
| 5 |
from fastmcp import Context
|
| 6 |
from fastmcp.exceptions import NotFoundError, PromptError
|
| 7 |
from fastmcp.prompts import Prompt
|
| 8 |
-
from fastmcp.prompts.prompt import PromptMessage, TextContent
|
| 9 |
from fastmcp.prompts.prompt_manager import PromptManager
|
| 10 |
|
| 11 |
|
|
@@ -97,6 +97,7 @@ class TestPromptManager:
|
|
| 97 |
# Should have replaced with the new prompt
|
| 98 |
prompt = manager.get_prompt("test_prompt")
|
| 99 |
assert prompt is not None
|
|
|
|
| 100 |
assert prompt.fn.__name__ == "replacement_fn"
|
| 101 |
|
| 102 |
def test_ignore_duplicate_prompts(self):
|
|
@@ -118,8 +119,10 @@ class TestPromptManager:
|
|
| 118 |
# Should keep the original
|
| 119 |
prompt = manager.get_prompt("test_prompt")
|
| 120 |
assert prompt is not None
|
|
|
|
| 121 |
assert prompt.fn.__name__ == "original_fn"
|
| 122 |
# Result should be the original prompt
|
|
|
|
| 123 |
assert result.fn.__name__ == "original_fn"
|
| 124 |
|
| 125 |
def test_get_prompts(self):
|
|
|
|
| 5 |
from fastmcp import Context
|
| 6 |
from fastmcp.exceptions import NotFoundError, PromptError
|
| 7 |
from fastmcp.prompts import Prompt
|
| 8 |
+
from fastmcp.prompts.prompt import FunctionPrompt, PromptMessage, TextContent
|
| 9 |
from fastmcp.prompts.prompt_manager import PromptManager
|
| 10 |
|
| 11 |
|
|
|
|
| 97 |
# Should have replaced with the new prompt
|
| 98 |
prompt = manager.get_prompt("test_prompt")
|
| 99 |
assert prompt is not None
|
| 100 |
+
assert isinstance(prompt, FunctionPrompt)
|
| 101 |
assert prompt.fn.__name__ == "replacement_fn"
|
| 102 |
|
| 103 |
def test_ignore_duplicate_prompts(self):
|
|
|
|
| 119 |
# Should keep the original
|
| 120 |
prompt = manager.get_prompt("test_prompt")
|
| 121 |
assert prompt is not None
|
| 122 |
+
assert isinstance(prompt, FunctionPrompt)
|
| 123 |
assert prompt.fn.__name__ == "original_fn"
|
| 124 |
# Result should be the original prompt
|
| 125 |
+
assert isinstance(result, FunctionPrompt)
|
| 126 |
assert result.fn.__name__ == "original_fn"
|
| 127 |
|
| 128 |
def test_get_prompts(self):
|