Allow accessing all arguments by name on mock call objects
未關閉
還沒有人認領這個 Issue。
stdlib
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Feature or enhancement
Currently, call objects from the unittest.mock library only provide a tuple of positional arguments and a dictionary of keyword arguments passed to the function. It should be possible to enable accessing all arguments by name, not just the keyword arguments. The Signature object can help with this: https://docs.python.org/3/library/inspect.html#introspecting-callables-with-the-signature-object.
Pitch
For more robust and readable testing code.
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先閱讀 unittest.mock 的 call 物件行為以及連結的 inspect.Signature 文件。決定如何在現有的位置參數 tuple 和關鍵字參數 dictionary 之外依名稱存取位置參數,然後定義預期的 API 與測試,以示範可讀的具名參數存取方式。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- testing
- Issue 類型
- 功能
- 難度
- 5/5
- 預估耗時
- 一週以上
- 活躍度
- 停滯
- 描述清晰度
- 需要釐清
- 新手友好度
- 30/100