Pytest 缺少近似方法
Pytest missing approx method
我在 Python 3.5.2(通过 Anaconda)中导入了 pytest 包,但它缺少 approx 方法。我尝试通过pip重新安装pytest,我仍然有同样的问题。 pytest的其他方法我还有很多,就是不约
我该如何解决这个问题?
1 import pytest
----> 2 assert 2 == pytest.approx(4.1/2)
AttributeError: module 'pytest' has no attribute 'approx'
你试过了吗,from _pytest.python import approx
?这个对我有用。如果没有,您可以使用 IDE 轻松搜索。我正在使用PyCharm,我只是通过双移位搜索单词approx
并获得了位置。
简单的 !!
我在 Python 3.5.2(通过 Anaconda)中导入了 pytest 包,但它缺少 approx 方法。我尝试通过pip重新安装pytest,我仍然有同样的问题。 pytest的其他方法我还有很多,就是不约
我该如何解决这个问题?
1 import pytest
----> 2 assert 2 == pytest.approx(4.1/2)
AttributeError: module 'pytest' has no attribute 'approx'
你试过了吗,from _pytest.python import approx
?这个对我有用。如果没有,您可以使用 IDE 轻松搜索。我正在使用PyCharm,我只是通过双移位搜索单词approx
并获得了位置。
简单的 !!