Package schrodinger :: Package test :: Package scival :: Module decorators :: Class printException
[hide private]
[frames] | no frames]

Class printException

object --+
         |
        printException

A decorator class specific to the scientific validation project that will catch an exception in a method and print out important information with this syntax:

ExceptionType (class.method) [test name] : error_message

To catch all exceptions: @printException('Exception')

To catch RuntimeError and ValueErrors: @printException('RuntimeError', 'ValueError')

If an exception is caught the method will return None.

Instance Methods [hide private]
 
__init__(self, *except_types)
Initialization of the decorator requires all exception types that you want to catch.
 
__call__(self, f=None)
If there are decorator arguments, __call__() is only called once, as part of the decoration process! You can only give it a single argument, which is the function object.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *except_types)
(Constructor)

 

Initialization of the decorator requires all exception types that you want to catch. If no exception types are supplied a RuntimeError will be raised. If an exception type passed in is not a member of the exceptions module an AttributeError is raised.

NOTE: The decorated method's args are not passed to the constructor

Parameters:
  • except_types (str) - Class names for exceptions
Overrides: object.__init__