这是什么
材料来自真实开源项目的公开问题与对应修复。一条序列从问题原文开始,经过定位、修改代码、运行测试,到修复后测试通过,保存完整的编码过程。
每条序列附一个可复现的运行环境,固定在问题发生时的代码基线上。修复是否成立,看项目自带的测试:与问题对应的测试在修复前失败、修复后通过。修复前后的测试输出和退出码各自保留,可以在环境里重跑核对。
每条注明来源项目、问题编号和许可协议。问题原文照录,连同报告者给出的复现代码和对照写法。编程语言和仓库不限于一种。
长什么样
样本取自一个开源数学计算库的公开问题:近似相等函数比较正无穷与正无穷时返回 False,与标准库中同类函数的处理不一致。样本含问题原文节选、修复前的测试输出(1 项失败,断言错误)和修复后的输出(1 项通过);结果记录中,修复前退出码为 1,修复后为 0。
看数据
任务说明
markdown
Consider adding support for special numbers in almosteq()
I.e. ``nan`` is not considered close to any other value, including ``nan`. ``inf`` and ``-inf`` are only considered close to themselves. See also [PEP 485](https://peps.python.org/pep-0485/).
Right now we have:
```pycon
>>> from mpmath import inf, mp
>>> mp.almosteq(inf, inf)
False
```
c.f.
```pycon
>>> from math import inf, isclose
>>> isclose(inf, inf)
True
```
Are there good reasons why ``almosteq()`` behave differently from the ``math.isclose()``?修复前
pytest
collected 1 item
mpmath/tests/test_basic_ops.py F [100%]
E AssertionError: assert False
+ where False = ae(mpf('+inf'))
+ where ae = mpf('+inf').ae
FAILED mpmath/tests/test_basic_ops.py::test_almost_equal - AssertionError: as...
============================== 1 failed in 0.22s ===============================修复后
pytest
collected 1 item
mpmath/tests/test_basic_ops.py . [100%]
PASSED mpmath/tests/test_basic_ops.py::test_almost_equal
============================== 1 passed in 0.40s ===============================结果
{
"问题": "mpmath #799",
"修复前": {
"exit_code": 1
},
"修复后": {
"exit_code": 0
}
}mpmath 公开问题与本地修复测试记录(节选)
内容与字段
- 领域
- 通用 AI 与专业任务
- 形态
- 数据集与环境
- 样本获取
- 可提供
页内展示的是样本预览;完整样本按“样本获取”一栏的方式提供。
编程语言与仓库按需
持续增加
- 01
说明
工作 目标 提供任务或研究问题、所需资料、使用阶段与预期交付格式。
- 02
核对
样本 与 条件 确认来源、使用范围、内容覆盖、版本与缺失,区分已有材料和需加工的部分。
- 03
约定
试制 与 接收 按项目确认批次、质量检查、验收方式与交付安排。