| 方法 | 检查 | 版本 |
| assertEqual(a, b) |
a ==b |
|
| assertEqual(first,second,msg=None) |
断言第一个参数和第二个参数是否相等,如果不相等则测试失败 |
|
| assertNotEqual(a, b) |
a !=b |
|
| assertNotEqual(first,second,msg=None) |
它用于第一个参数与第二个参数是否不相等,如果相等则测试失败 |
|
| assertTrue(expr,x) |
bool(x) is True |
|
| 测试表达式是true(或false) |
|
|
| assertFalse(expr,x) |
Bool(x) is False |
|
| 测试表达式是true(或false) |
|
|
| assertIs(a, b) |
a is b |
3.1 |
| assertIn(first,second,msg=None) |
断言第一个参数和第二个参数是否为同一个对象 |
|
| assertIsNot(a, b) |
a is not b |
3.1 |
| assertNotIn(first,second,msg=None) |
断言第一个参数和第二个参数是否为同一个对象 |
|
| assertIsNone(x) |
x is None |
3.1 |
| assertIsNone(first,second,msg=None) |
断言表达式是否为None对象 |
|
| assertIsNotNone(x) |
x is not None |
3.1 |
| assertIsNotNone(first,second,msg=None) |
断言表达式是否为None对象 |
|
| assertIsInstance(a, b) |
isinstance(a,b) |
3.1 |
| assertIsInstance(first,second,msg=None) |
断言obj是否为cls的一个实例 |
|
| assertNotIsInstance(a, b) |
not isinstance(a,b) |
3.1 |
| assertIsNotInstance(first,second,msg=None) |
断言obj是否为cls的一个实例 |
|
| 方法 | 检查 | 版本 |
| assertAlmostEqual(a,b) |
|
|
| assertGreater(a, b[, msg]) |
a>b |
|
| assertGreaterEqual(a, b[, msg]) |
a>=b |
|
| assertNotAlmostEqual(a,b) |
|
|
| assertLess(a,b) |
a<b |
|
| assertLessEqual(a,b) |
a<=b |
|
| assertRegex(s,r) |
r.search(s) |
|
| assertNotRegex(s, r) |
not .search(s) |
|
| |
|
|
学习,学习,学习!
学习是为了更好的未来,不要让别人瞧不起你,加油!!!