1. from unittest import TestCase, expectedFailure
    
  2. 
    
  3. 
    
  4. class FailureTestCase(TestCase):
    
  5.     def test_sample(self):
    
  6.         self.assertEqual(0, 1)
    
  7. 
    
  8. 
    
  9. class ErrorTestCase(TestCase):
    
  10.     def test_sample(self):
    
  11.         raise Exception("test")
    
  12. 
    
  13. 
    
  14. class ExpectedFailureTestCase(TestCase):
    
  15.     @expectedFailure
    
  16.     def test_sample(self):
    
  17.         self.assertEqual(0, 1)
    
  18. 
    
  19. 
    
  20. class UnexpectedSuccessTestCase(TestCase):
    
  21.     @expectedFailure
    
  22.     def test_sample(self):
    
  23.         self.assertEqual(1, 1)