小编Joh*_*ith的帖子

`MagicMock` 可以与 python3 中的 int 进行比较吗?

我正在迁移我的项目的 python 版本 (2->3)。测试对 python2 工作正常,但对 python3 抱怨,错误就像

TypeError: '>' not supported between instances of 'MagicMock' and 'int'
Run Code Online (Sandbox Code Playgroud)

这是一个最小的案例

TypeError: '>' not supported between instances of 'MagicMock' and 'int'
Run Code Online (Sandbox Code Playgroud)

赶紧跑 py.test .

这些黑客不起作用

MagicMock.__le__ = some_le_method # just not working

MagicMock.__le__.__func__.__code = some_le_method.__func__.__code__ # wrapper_descriptor does not have attribute __func__
Run Code Online (Sandbox Code Playgroud)

python python-2.7 python-3.x

5
推荐指数
1
解决办法
2426
查看次数

标签 统计

python ×1

python-2.7 ×1

python-3.x ×1