|  9.4 Test Assert Methods  PyUnit provides 18 test assert methods. Many of them are aliases for the same methods. Most take an optional descriptive message argument, which is reported in case of test failure.   The test assert methods are defined within the class  TestCase  and are described in the following list. Their first argument,  self  , is a reference to the  TestCase  instance. When invoking these methods within a test method, this argument is implicit and does not need to be passed.    
    assert_(self, expr, msg=None)     
    failUnless(self, expr, msg=None)      Test passes if  expr  is  true  . This is the most generic assert method.  
    assertEqual(self, first, second, msg=None)     
    assertEquals(self, first, second, msg=None)     
    failUnlessEqual(self, first, second, msg=None)      Test passes if  first  and  second  are equal when compared using  ==  .  
    assertNotEqual(self, first, second, msg=None)     
    assertNotEquals(self, first, second, msg=None)     
    failIfEqual(self, first, second, msg=None)      Test fails if  first  and  second  are equal when compared using  ==  .  
    assertAlmostEqual(self, first, second, places=7, msg=None)     
    assertAlmostEquals(self, first, second, places=7, msg=None)     
    failUnlessAlmostEqual(self, first, second, places=7, msg=None)      Test passes if  first  and  second  are equal after being rounded to  places  decimal places.  
    assertNotAlmostEqual(self, first, second, places=7, msg=None)     
    assertNotAlmostEquals(self, first, second, places=7, msg=None)     
    failIfAlmostEqual(self, first, second, places=7, msg=None)      Test fails if  first  and  second  are equal after being rounded to  places  decimal places.  
    assertRaises(self, excClass, callableObj, *args, **kwargs)     
    failUnlessRaises(self, excClass, callableObj, *args, **kwargs)      Call  callableObj  with arguments  args  and keyword arguments  kwargs  . This assert passes if an exception of type  excClass  is thrown.  
    fail(self, msg=None)      Test assert that always fails.  
    failIf(self, expr, msg=None)      Test fails if  expr  is  true  .  |