Package harold :: Module utesttools
[show private | hide private]
[frames | no frames]

Module harold.utesttools

Useful functions and classes for building unit tests.
Function Summary
    Decorators
  assertNotRaise(exception_class)
A decorator maker for test methods in test cases.
  assertRaises(exception_class)
A parametrized decorator for test methods in test cases.
  failIfRaises(exception_class)
A decorator maker for test methods in test cases.
  failUnlessRaises(exception_class)
A parametrized decorator for test methods in test cases.

Function Details

assertNotRaise(exception_class)

A decorator maker for test methods in test cases. It checks that the decorated function does not raise the given exception class.

Also known as assertNotRaise.

Usage example:
 class MyTest (TestCase):
     @failIfRaises (AttributeError)
     def test_x_has_y (self):
         "test that x has an attribute named y"
         self.x.y
Parameters:
exception_class - a subclass of Exception or a tuple of such subclasses

Synonyms:

assertRaises(exception_class)

A parametrized decorator for test methods in test cases. It checks that the decorated function raises the given exception class.

Usage example:
 class MyTest (TestCase):
     @failUnlessRaises (AttributeError)
     def test_x_has_no_y (self):
         "test that x has no attribute named y"
         self.x.y
Parameters:
exception_class - a subclass of Exception or a tuple of such subclasses

Synonyms:

failIfRaises(exception_class)

A decorator maker for test methods in test cases. It checks that the decorated function does not raise the given exception class.

Also known as assertNotRaise.

Usage example:
 class MyTest (TestCase):
     @failIfRaises (AttributeError)
     def test_x_has_y (self):
         "test that x has an attribute named y"
         self.x.y
Parameters:
exception_class - a subclass of Exception or a tuple of such subclasses

Synonyms:

failUnlessRaises(exception_class)

A parametrized decorator for test methods in test cases. It checks that the decorated function raises the given exception class.

Usage example:
 class MyTest (TestCase):
     @failUnlessRaises (AttributeError)
     def test_x_has_no_y (self):
         "test that x has no attribute named y"
         self.x.y
Parameters:
exception_class - a subclass of Exception or a tuple of such subclasses

Synonyms:


Generated by Epydoc 2.1 on Mon Dec 18 15:25:58 2006 http://epydoc.sf.net