unittest assert assertion

unittest common assertion methods

1.assertEqual(self, first, second, msg=None)

- Analyzing the parameters are equal: first == second

2.assertNotEqual(self, first, second, msg=None)

- determining two parameters are not equal: first! = Second

3.assertIn(self, member, container, msg=None)

- to determine whether a string contains: member in container

4.assertNotIn(self, member, container, msg=None)

- to determine whether the string is not included: member not in container

5.assertTrue(self, expr, msg=None)

- judgment is true: expr is True

6.assertFalse(self, expr, msg=None)

- to determine whether or false: expr is False

7.assertIsNone(self, obj, msg=None)

- to determine whether or None: obj is None

8.assertIsNotNone (Self, obj, MSG = None)
- determines whether or not None: obj is not None

Guess you like

Origin www.cnblogs.com/yaohu/p/11593447.html