断言Assertion
| 方法 | 检查 | 版本 | 
| assertEqual(a,b) | a==b | |
| assertNotEqual(a,b) | a!=b | |
| asserTrue(x) | bool(x) is true | |
| asserFalse(x) | bool(x) is False | |
| assertIs(a,b) | a is b | |
| assertIsNot(a,b) | a is not b | |
| assertIsNone(x) | x is None | |
| assertIsNoneNot(x) | x is not None | |
| assertIn(a,b) | a in b | |
| assertInNot | a not in b | |
| assertIsInstance(a,b) | isinstance(a,b) | |
| assertNotIsInstance(a,b) | not isinstance (a,b) | 
正常断言失败则会停止测试用例运行,但是增加了异常捕获,失败了还能继续运行
使用:

原文:https://www.cnblogs.com/may18/p/12835447.html