-
Notifications
You must be signed in to change notification settings - Fork 2
14. unittest Assert Methods
NaveenS edited this page Aug 11, 2019
·
1 revision
The TestCase class provides several assert methods to check for and report failures. The following are the most commonly used methods:
Test that first and second are equal. If the values do not compare equal, the test will fail.
Test that first and second are not equal. If the values do compare equal, the test will fail.
Test that expr is true (or false).
Test that first and second evaluate (or don’t evaluate) to the same object.
Test that expr is (or is not) None.
Test that first is (or is not) in second.
Test that obj is (or is not) an instance of cls (which can be a class or a tuple of classes, as supported by
isinstance()). To check for the exact type, use assertIs(type(obj), cls).