本文整理汇总了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)