def custom(function):
"""
A function decorator, used to mark functions which build custom (dynamic)
test suites when called.
@param function: a callable object, which returns a dynamically compiled
C{unittest.TestSuite}
@type function: callable
"""
if isinstance(function, type):
raise TypeError("Can't apply function decorator on a class")
elif not hasattr(function, '__call__'):
raise TypeError("Can't apply function decorator on non-callable {0}".format(type(function)))
setattr(function, Attributes.CUSTOM, True)
return function
评论列表
文章目录