def assertException( exceptionType, f, msg = None ):
        """Assert that an exception of type \var{exceptionType}
        is thrown when the function \var{f} is evaluated.
        """
        try:
            f()
        except exceptionType:
            assert True
        else:
            print >>sys.stderr, "Error: expected <%s> to be thrown by function%s" % ( exceptionType.__name__, colon( msg ) )
            traceback.print_stack()
Assert that an exception of type ar{exceptionType}
        is thrown when the function ar{f} is evaluated.
        
recipes/Python/577482_Easy_property/recipe-577482.py