FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-sdk/tests/shared/test_memory.py at main · roschler/python-sdk · GitHub
roschler
/
python-sdk
Public
forked from
modelcontextprotocol/python-sdk
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-sdk
/
tests
/
shared
/
test_memory.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
47 lines (38 loc) · 1.19 KB
Breadcrumbs
python-sdk
/
tests
/
shared
/
test_memory.py
Copy path
File metadata and controls
47 lines (38 loc) · 1.19 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import
pytest
from
pydantic
import
AnyUrl
from
typing_extensions
import
AsyncGenerator
from
mcp
.
client
.
session
import
ClientSession
from
mcp
.
server
import
Server
from
mcp
.
shared
.
memory
import
(
create_connected_server_and_client_session
,
)
from
mcp
.
types
import
(
EmptyResult
,
Resource
,
)
@
pytest
.
fixture
def
mcp_server
()
->
Server
:
server
=
Server
(
name
=
"test_server"
)
@
server
.
list_resources
()
async
def
handle_list_resources
():
return
[
Resource
(
uri
=
AnyUrl
(
"memory://test"
),
name
=
"Test Resource"
,
description
=
"A test resource"
,
)
]
return
server
@
pytest
.
fixture
async
def
client_connected_to_server
(
mcp_server
:
Server
,
)
->
AsyncGenerator
[
ClientSession
,
None
]:
async
with
create_connected_server_and_client_session
(
mcp_server
)
as
client_session
:
yield
client_session
@
pytest
.
mark
.
anyio
async
def
test_memory_server_and_client_connection
(
client_connected_to_server
:
ClientSession
,
):
"""Shows how a client and server can communicate over memory streams."""
response
=
await
client_connected_to_server
.
send_ping
()
assert
isinstance
(
response
,
EmptyResult
)
Back
|
FazBrowse Home
|
New Git URL