Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Developer Knowledge fallback search response is not iterable

未關閉 適合新手
#14,609 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
88/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
backend, testing

研究方向

從 developer-knowledge/conftest.py 開始檢查 fallback 的 SearchDocumentChunksResponse,然後將其行為與 developer-knowledge/search_document_chunks.py 中的迭代進行比較。執行 python -m pytest developer-knowledge -q;完成表示四個重點測試全部通過,且範例的分頁迴圈可以使用 fallback 回應。

由索引模型根據 Issue 內容生成。

描述

samples

In which file did you encounter the issue?

developer-knowledge/conftest.py and developer-knowledge/search_document_chunks.py

Did you change the file? If so, how?

No.

Describe the issue

The Developer Knowledge samples include a fallback implementation for environments where the preview client is not installed. The fallback SearchDocumentChunksResponse stores its results but is not iterable, while the sample iterates over the response as a pager.

Reproduction command:

python -m pytest developer-knowledge -q

Result:

3 passed, 1 failed
...
developer-knowledge\\search_document_chunks.py:44: in search_document_chunks
    for chunk in response:
TypeError: 'SearchDocumentChunksResponse' object is not iterable

Expected behavior: all four focused tests pass using the intended fallback. Actual behavior: the search test fails before it can exercise the sample.

Environment: Python 3.12, pytest 9.1.1, repository main at commit 430a87ada6f2d33f318b5d16b77464679905a140.

主要語言
Jupyter Notebook
星號
8.1k
分支
6.7k
平均合併
4 天 4 小時
30 天內合併 PR
8

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

GoogleCloudPlatform/python-docs-samples 的其他 Issue

查看 GoogleCloudPlatform/python-docs-samples 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。