我正在学习unittest,并尝试使用以下两个.py脚本,但是当我在终端上运行时,它显示“运行0个测试”。我究竟做错了什么?
健全性
def firstname(name):
return name.title()
然后第二
sanitycheck.py
import unittest
import sanity
class TestingCap(unittest.TestCase):
def firstone(self):
word = 'apple'
result = sanity.firstname(word)
self.assertEqual(result,'apple')
if __name__ == '__main__':
unittest.main()
谢谢!
您应该使用测试来命名该文件。 例: