---
title: "請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點 - Keith Yang"
tags: PyConTW2025, 2025-organize, 2025-共筆
---
# 請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點 - Keith Yang
{%hackmd L_RLmFdeSD--CldirtUhCw %}
<iframe src=https://app.sli.do/event/35jtNRt76towPHZ3sLkavt height=450 width=100%></iframe>
:::success
本演講提供 AI 翻譯字幕及摘要,請點選這裡前往 >> [PyCon Taiwan AI Notebook](https://pycontw.connyaku.app/?room=iSxL5ssMvraflv7SDDZs)
AI translation subtitles and summaries are available for this talk. Click here to access >> [PyCon Taiwan AI Notebook](https://pycontw.connyaku.app/?room=iSxL5ssMvraflv7SDDZs)
:::
> Collaborative writing start from below
> 從這裡開始共筆
- Part 1: AI Agent 生成 Code 的現況和挑戰
- Code 生成都會用 [SWE-bench](https://www.swebench.com/) 來評估 AI 寫 Code 的好壞
- [SWE-bench](https://www.swebench.com/) 的限制是**程式碼品質問題**
- [SWE-bench Bash-Only](https://www.swebench.com/bash-only.html) 是因應 Claude Code 出來的變體
- 只能用 Bash 來評估
- AI Coding 的 Level
- AI 程式補全
- AI Driven Dev
- AI Architect
- ...(略)
- AI Auto Dev
- Live Coding Result
- VSCode + Codex (OpenAI)
- Task:重構
- Kiro (Amazon)
- Vibe Coding & SPEC Driven
- Claude Code(常用)
- Gemini Code (Google)
- [TDD, Al agents and coding with Kent Beck](https://www.youtube.com/watch?v=aSXaxOdVtAQ)
- AI Coding Tips
- Prompt
- Write only minimal neccesssary critical tests
- Use parameterizex for similar tests 參數化
- 也可以寫到 CLAUDE.md (.local) and AGENTS.md cursor/rules .kiro
- Unit Test
- 寫死靜態值
- 避免mock到要測的部分
- AI 時代 Code Review
- 著重邏輯合理性
- Reviewer: 審查風格->確定邏輯正確性
- Code Reference Zero Truth
- 預防不必要的工作
- 阻止PM放棄不可行的需求
- 改善開發體驗
-
## Reference
[講者2021 pycon演講 - 成功地測試失敗](https://tw.pycon.org/2021/zh-hant/conference/talk/210/)
[講者2024 pycon演講 - 以 Python 應用來推進餐飲雲端 POS 系統:一個後端開發者的實戰分享](https://tw.pycon.org/2024/en-us/conference/talk/316/)
Below is the part that speaker updated the talk/tutorial after speech
講者於演講後有更新或勘誤投影片的部份