python类SimpleTestCase()的实例源码

tests.py 文件源码 项目:munch-core 作者: crunchmail 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __call__(self, test_func):
        from django.test import SimpleTestCase
        if isinstance(test_func, type):
            if not issubclass(test_func, SimpleTestCase):
                raise Exception(
                    "Only subclasses of Django SimpleTestCase "
                    "can be decorated with temporary_settings")
            return test_func
        else:
            @wraps(test_func)
            def inner(*args, **kwargs):
                with self:
                    return test_func(*args, **kwargs)
        return inner


问题


面经


文章

微信
公众号

扫码关注公众号