本文整理汇总了Python中django.contrib.staticfiles.finders.BaseFinder方法的典型用法代码示例。如果您正苦于以下问题:Python finders.BaseFinder方法的具体用法?Python finders.BaseFinder怎么用?Python finders.BaseFinder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.contrib.staticfiles.finders
的用法示例。
在下文中一共展示了finders.BaseFinder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_base_finder_check_not_implemented
# 需要导入模块: from django.contrib.staticfiles import finders [as 别名]
# 或者: from django.contrib.staticfiles.finders import BaseFinder [as 别名]
def test_base_finder_check_not_implemented(self):
finder = BaseFinder()
msg = 'subclasses may provide a check() method to verify the finder is configured correctly.'
with self.assertRaisesMessage(NotImplementedError, msg):
finder.check()
示例2: test_check_finders
# 需要导入模块: from django.contrib.staticfiles import finders [as 别名]
# 或者: from django.contrib.staticfiles.finders import BaseFinder [as 别名]
def test_check_finders(self):
"""check_finders() concatenates all errors."""
error1 = Error('1')
error2 = Error('2')
error3 = Error('3')
def get_finders():
class Finder1(BaseFinder):
def check(self, **kwargs):
return [error1]
class Finder2(BaseFinder):
def check(self, **kwargs):
return []
class Finder3(BaseFinder):
def check(self, **kwargs):
return [error2, error3]
class Finder4(BaseFinder):
pass
return [Finder1(), Finder2(), Finder3(), Finder4()]
with mock.patch('django.contrib.staticfiles.checks.get_finders', get_finders):
errors = check_finders(None)
self.assertEqual(errors, [error1, error2, error3])