本文整理匯總了Python中scrapy.settings.BaseSettings._getcomposite方法的典型用法代碼示例。如果您正苦於以下問題:Python BaseSettings._getcomposite方法的具體用法?Python BaseSettings._getcomposite怎麽用?Python BaseSettings._getcomposite使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類scrapy.settings.BaseSettings
的用法示例。
在下文中一共展示了BaseSettings._getcomposite方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_getcomposite
# 需要導入模塊: from scrapy.settings import BaseSettings [as 別名]
# 或者: from scrapy.settings.BaseSettings import _getcomposite [as 別名]
def test_getcomposite(self):
s = BaseSettings({'TEST_BASE': {1: 1, 2: 2},
'TEST': BaseSettings({1: 10, 3: 30}, 'default'),
'HASNOBASE': BaseSettings({1: 1}, 'default')})
s['TEST'].set(4, 4, priority='project')
# When users specify a _BASE setting they explicitly don't want to use
# Scrapy's defaults, so we don't want to see anything that has a
# 'default' priority from TEST
cs = s._getcomposite('TEST')
self.assertEqual(len(cs), 3)
self.assertEqual(cs[1], 1)
self.assertEqual(cs[2], 2)
self.assertEqual(cs[4], 4)
cs = s._getcomposite('HASNOBASE')
self.assertEqual(len(cs), 1)
self.assertEqual(cs[1], 1)
cs = s._getcomposite('NONEXISTENT')
self.assertIsNone(cs)