TestCase.assertEqual()
TestCase.assertEqual() is a Python method in the Unittest Module category. Tests that first == second. Fails with msg if not equal. The syntax is TestCase.assertEqual(first, second, msg=None). Returns: None. A typical example: self.assertEqual(3.14, 3.14). A close sibling is unittest.TestCase(), which base class for writing unit tests. Provides assertion methods and test runner support. A close sibling is TestCase.assertTrue(), which tests that expr is True. A close sibling is TestCase.assertFalse(), which tests that expr is False. A close sibling is TestCase.assertRaises(), which tests that an exception is raised when callable is called. More about this category: Unit testing framework — TestCase, assertEqual, assertRaises, TestSuite. Related Unittest Module entries: unittest.TestCase(), TestCase.assertTrue(), TestCase.assertFalse(), TestCase.assertRaises(), TestCase.assertIn(), TestCase.assertIsNone(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try TestCase.assertEqual() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.