__init__.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:CSB 作者: csb-toolbox 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号