本文整理匯總了Python中safe.impact_function.impact_function.ImpactFunction._check_layer方法的典型用法代碼示例。如果您正苦於以下問題:Python ImpactFunction._check_layer方法的具體用法?Python ImpactFunction._check_layer怎麽用?Python ImpactFunction._check_layer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類safe.impact_function.impact_function.ImpactFunction
的用法示例。
在下文中一共展示了ImpactFunction._check_layer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_keyword_monkey_patch
# 需要導入模塊: from safe.impact_function.impact_function import ImpactFunction [as 別名]
# 或者: from safe.impact_function.impact_function.ImpactFunction import _check_layer [as 別名]
def test_keyword_monkey_patch(self):
"""Test behaviour of generating keywords."""
exposure_path = standard_data_path('exposure', 'building-points.shp')
# noinspection PyCallingNonCallable
exposure_layer = QgsVectorLayer(exposure_path, 'Building', 'ogr')
impact_function = ImpactFunction()
impact_function.exposure = exposure_layer
impact_function._check_layer(impact_function.exposure, 'exposure')
expected_inasafe_fields = {
exposure_type_field['key']: 'TYPE',
}
self.assertDictEqual(
exposure_layer.keywords['inasafe_fields'], expected_inasafe_fields)
fields = impact_function.exposure.dataProvider().fieldNameMap().keys()
self.assertIn(
exposure_layer.keywords['inasafe_fields']['exposure_type_field'],
fields
)
inasafe_fields = exposure_layer.keywords['inasafe_fields']