网站推广方案案例,渭南建筑工程网,欧莱雅官方网站的建设,wordpress用户名密码通常#xff0c;您希望从django的unittest类TestCase继承#xff0c;可以从django.测试. 也就是说#xff0c;您可以将msg参数传递给您要评估的任何内容#xff0c;其中包含失败消息。在以下是“人性化”的一个例子#xff1a;class HumanizeTests(TestCase):def humanize…通常您希望从django的unittest类TestCase继承可以从django.测试. 也就是说您可以将msg参数传递给您要评估的任何内容其中包含失败消息。在以下是“人性化”的一个例子class HumanizeTests(TestCase):def humanize_tester(self, test_list, result_list, method):# Using max below ensures we go through both lists# However, if the lists are not equal length, this raises an exceptionfor test_content, result in zip(test_list, result_list):t Template({%% load humanize %%}{{ test_content|%s }} % method)rendered t.render(Context(locals())).strip()self.assertEqual(rendered, escape(result),msg%s test failed, produced %s, shouldve produced %s % (method, rendered, result))显然你的不需要看起来像上面这样但是你可以看到msg参数的作用。在