unittest.TestCase.assertNotEqual()

assertNotEqual(first, second, msg=None) Test that first and second are not equal. If the values do compare equal, the test will fail.

unittest.TestCase.assertNotAlmostEqual()

assertNotAlmostEqual(first, second, places=7, msg=None, delta=None) Test that first and second are approximately (or not approximately) equal by computing the difference, rounding to the given number of decimal places (default 7), and comparing to zero. Note that these methods round the values to the given number of decimal places (i.e. like the round() function) and not significant digits. If delta is supplied instead of places then the difference between first and second must be less or eq

unittest.TestCase.assertMultiLineEqual()

assertMultiLineEqual(first, second, msg=None) Test that the multiline string first is equal to the string second. When not equal a diff of the two strings highlighting the differences will be included in the error message. This method is used by default when comparing strings with assertEqual(). New in version 3.1.

unittest.TestCase.assertLogs()

assertLogs(logger=None, level=None) A context manager to test that at least one message is logged on the logger or one of its children, with at least the given level. If given, logger should be a logging.Logger object or a str giving the name of a logger. The default is the root logger, which will catch all messages. If given, level should be either a numeric logging level or its string equivalent (for example either "ERROR" or logging.ERROR). The default is logging.INFO. The test passes if

unittest.TestCase.assertListEqual()

assertListEqual(first, second, msg=None) assertTupleEqual(first, second, msg=None) Tests that two lists or tuples are equal. If not, an error message is constructed that shows only the differences between the two. An error is also raised if either of the parameters are of the wrong type. These methods are used by default when comparing lists or tuples with assertEqual(). New in version 3.1.

unittest.TestCase.assertLessEqual()

assertLessEqual(first, second, msg=None) Test that first is respectively >, >=, < or <= than second depending on the method name. If not, the test will fail: >>> self.assertGreaterEqual(3, 4) AssertionError: "3" unexpectedly not greater than or equal to "4" New in version 3.1.

unittest.TestCase.assertLess()

assertLess(first, second, msg=None) assertLessEqual(first, second, msg=None) Test that first is respectively >, >=, < or <= than second depending on the method name. If not, the test will fail: >>> self.assertGreaterEqual(3, 4) AssertionError: "3" unexpectedly not greater than or equal to "4" New in version 3.1.

unittest.TestCase.assertIsNotNone()

assertIsNotNone(expr, msg=None) Test that expr is (or is not) None. New in version 3.1.

unittest.TestCase.assertIsNot()

assertIsNot(first, second, msg=None) Test that first and second evaluate (or don’t evaluate) to the same object. New in version 3.1.

unittest.TestCase.assertIsNone()

assertIsNone(expr, msg=None) assertIsNotNone(expr, msg=None) Test that expr is (or is not) None. New in version 3.1.