本文整理匯總了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])