Python django.test 模块,SimpleTestCase() 实例源码
我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用django.test.SimpleTestCase()。
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