Juicy lil' bytes

Python Testing Assertion Methods

Here’s a complete list of the Python assertion methods that are available in the Python unittest module for versions 2 & 3 of the Python interpreter.

Python Assertions

Method Assertion Min Version
assertEqual(a,b) a == b 2 & 3
assertNotEqual(a,b) a != b 2 & 3
assertIsNone(x) x is None 3.1 +
assertIsNotNone(x) x is not None 3.1 +
assertIn(a,b) a in b 3.1 +
assertNotIn(a,b) a not in b 3.1 +
assertIsInstance(a,b) isinstance(a,b) 3.2 +
assertNotIsInstance(a,b) not isinstance(a,b) 3.2 +

Python Documentation

And here is the link to the Python documentation on the topic.