Unchanged lines detected as changes with difflib.HtmlDiff
未關閉
還沒有人認領這個 Issue。
stdlib
type-bug
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 36k
- PR 合併指標
- PR 指標待擷取
描述
Bug report
Bug description:
When running HtmlDiff on test_api_result.response.txt test_api_result.expected.txt (reported at https://github.com/jeffkaufman/icdiff/issues/223) unchanged lines are being detected as changes. Here's the setup:
import difflib
a = open("test_api_result.response.txt").readlines()
b = open("test_api_result.expected.txt").readlines()
with open("tmp.html", "w") as outf:
outf.write(difflib.HtmlDiff().make_file(a,b))
And the results: https://www.jefftk.com/html-diff-output-repro
I don't see these spurious deltas when running diff:
$ diff test_api_result.*
31,32c31,32
< 'latitude': 1,
< 'longitude': 1,
---
> 'latitude': 1.0,
> 'longitude': 1.0,
40c40
< 'meeting_url': '',
---
> 'meeting_url': None,
77,78c77,78
< 'latitude': 1,
< 'longitude': 1,
---
> 'latitude': 1.0,
> 'longitude': 1.0,
86c86
< 'meeting_url': '',
---
> 'meeting_url': None,
...
CPython versions tested on:
3.13
Operating systems tested on:
macOS
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
先使用 test_api_result.response.txt 和 test_api_result.expected.txt 重現該報告,然後檢查所提供重現頁面上的 HtmlDiff 輸出,並將其與 diff 進行比較。當未變更的行不再被標記為變更,同時實際差異仍然可見時,工作就完成了。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- tooling
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100