Unchanged lines detected as changes with difflib.HtmlDiff
未关闭
还没有人认领这个 Issue。
stdlib
type-bug
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 35.9k
- 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