import unittestclass study(unittest.TestCase): def testXia(self): self.assertEqual((3*4),20) def testHong(self): self.assertEqual(2,2)if __name__=="__main__": unittest.main()注意:1.方法的命名以test开头;2.查看unittest的用法,help(unittest);3.查看**的属性,dir(unittest.TestCase);
来源:https://www.cnblogs.com/canglongdao/p/11966851.html