本文整理汇总了Python中safe.impact_function.impact_function.ImpactFunction.performance_log_message方法的典型用法代码示例。如果您正苦于以下问题:Python ImpactFunction.performance_log_message方法的具体用法?Python ImpactFunction.performance_log_message怎么用?Python ImpactFunction.performance_log_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe.impact_function.impact_function.ImpactFunction
的用法示例。
在下文中一共展示了ImpactFunction.performance_log_message方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_profiling
# 需要导入模块: from safe.impact_function.impact_function import ImpactFunction [as 别名]
# 或者: from safe.impact_function.impact_function.ImpactFunction import performance_log_message [as 别名]
def test_profiling(self):
"""Test running impact function on test data."""
hazard_layer = load_test_vector_layer(
'gisv4', 'hazard', 'classified_vector.geojson')
exposure_layer = load_test_vector_layer(
'gisv4', 'exposure', 'building-points.geojson')
aggregation_layer = load_test_vector_layer(
'gisv4', 'aggregation', 'small_grid.geojson')
# Set up impact function
impact_function = ImpactFunction()
impact_function.aggregation = aggregation_layer
impact_function.exposure = exposure_layer
impact_function.hazard = hazard_layer
status, message = impact_function.run()
self.assertEqual(ANALYSIS_FAILED_BAD_INPUT, status, message)
impact_function.prepare()
status, message = impact_function.run()
self.assertEqual(ANALYSIS_SUCCESS, status, message)
message = impact_function.performance_log_message().to_text()
expected_result = get_control_text(
'test-profiling-logs.txt')
for line in expected_result:
line = line.replace('\n', '')
if line == '' or line == '-':
continue
self.assertIn(line, message)
# Notes(IS): For some unknown reason I need to do this to make
# test_provenance pass
del hazard_layer