python unittest学习7---第二类方法,assert相关方法

assertEqual(firstsecondmsg=None)

只有first和second相等时,才是通过,否则不通过。first和second可以是任意类型,当判断是否相等时调用特定类型的相等函数判断,所以会给出明确的错误信息。

assertNotEqual(firstsecondmsg=None)

只有first和second不相等时,才是通过,否则不通过。

assertTrue(exprmsg=None)assertFalse(exprmsg=None)

其中是判断bool(expr),并非是指expr为True或False

assertIs(firstsecondmsg=None)assertIsNot(firstsecondmsg=None)

assertIsNone(exprmsg=None)assertIsNotNone(exprmsg=None)

assertIn(firstsecondmsg=None)assertNotIn(firstsecondmsg=None)

扫描二维码关注公众号,回复: 6348626 查看本文章

assertIsInstance(objclsmsg=None)assertNotIsInstance(objclsmsg=None)

猜你喜欢

转载自www.cnblogs.com/dmtz/p/10974293.html