【发布时间】:2017-02-16 11:57:56
【问题描述】:
我正在关注 pytest 的本教程:
http://doc.pytest.org/en/latest/getting-started.html#grouping-multiple-tests-in-a-class
但注意到如果我创建:
class ComplexTestClass:
"""
Complex and more nuanced tests for specific sentences
"""
def test_multiple_sentences():
如果我没有在函数顶部添加@staticmethod,我会在函数上出现一个错误,它无法使用() is 获取,并且它在我的 PyCharm 中以红色突出显示。
教程(显示不需要静态方法)是错的,还是我错了,staticmethod 会使我的测试无效?
【问题讨论】:
标签: python unit-testing oop static-methods pytest