docs: refresh translations, and translate pages in parallel (#3458)
This commit is contained in:
parent
08a3bc8eaf
commit
fd66270926
1 changed files with 4821 additions and 2277 deletions
|
|
@ -1,13 +1,13 @@
|
|||
---
|
||||
translation:
|
||||
sections: ['4926721070127497', c52a1de2b6b32f40, 8e792bf8c7489ec6, 627195f7159e24ef]
|
||||
sections: [5d13c2f0ba42c0d2, c52a1de2b6b32f40, 8e792bf8c7489ec6, 38552ea228b0a04f]
|
||||
tool: 1
|
||||
---
|
||||
# 測試 {#testing}
|
||||
|
||||
Python SDK 附帶一個 `Client` 類別,內建**記憶體內傳輸**:把伺服器物件傳給它,它就會直接連上去。
|
||||
SDK 的 `Client` 類別,也就是連到 URL 或啟動子處理程序的同一個類別,也能在**記憶體內**連線:把伺服器物件傳給它,它就會直接和伺服器對話。
|
||||
|
||||
沒有子處理程序,沒有連接埠,根本沒有傳輸層。概念和 FastAPI 的 `TestClient` 一樣。
|
||||
沒有子處理程序,沒有連接埠,線路上什麼都沒有。概念和 FastAPI 的 `TestClient` 一樣。
|
||||
|
||||
## 基本用法 {#basic-usage}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ async def test_call_add_tool(client: Client):
|
|||
|
||||
測試裡就開著它。在正式環境的程式碼裡它沒有任何意義。
|
||||
|
||||
## 預設為處理程序內連線 {#in-process-by-default}
|
||||
## 預設為世代中立 {#era-neutral-by-default}
|
||||
|
||||
!!! note
|
||||
`Client(mcp)` 以處理程序內的方式連線,而且預設是**世代中立**的:它會探測伺服器,選出合適的協定路徑。如果測試要驗證舊版特有的語意(取樣(sampling)或徵詢(elicitation)的推送、`message_handler`),就固定用 `mode="legacy"`,並且在那裡拿掉 `raise_exceptions=True`:舊版連線本來就不會淨化,而這個旗標會讓失敗在伺服器任務裡重新引發,而不是在你的測試裡。
|
||||
|
|
|
|||
Loading…
Reference in a new issue