能帮我吗?
我已经开始以质量检查的方式学习python,
使用:Python 3 *导入单元测试 从ddt导入ddt,数据,idata,file_data,解压缩
这是一个示例,我不知道此脚本有什么问题(我从网络博客中引用了它)
import unittest
from ddt import ddt, data, idata, file_data, unpack
@ddt
class TestDDTData(unittest.TestCase):
@data((3, 2), (4, 3), (5, 3))
@unpack
def test_tuples_extracted_into_arguments(self, first_value, second_value):
self.assertTrue(first_value > second_value)
控制台输出:
Error
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 59, in testPartExecutor
yield
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/case.py", line 628, in run
testMethod()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 34, in testFailure
raise self._exception
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/unittest/loader.py", line 169, in loadTestsFromName
parent, obj = obj, getattr(obj, part)
AttributeError: type object 'TestDDTData' has no attribute 'test_tuples_extracted_into_arguments'
Ran 1 test in 0.005s
FAILED (errors=1)
Process finished with exit code 1
Assertion failed
Assertion failed
Assertion failed
Assertion failed
Assertion failed
Assertion failed
Assertion failed
Assertion failed
感谢您的帮助