当前位置: 首页>>代码示例>>Python>>正文


Python ImpactFunction.performance_log_message方法代码示例

本文整理汇总了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
开发者ID:ismailsunni,项目名称:inasafe,代码行数:34,代码来源:test_impact_function.py


注:本文中的safe.impact_function.impact_function.ImpactFunction.performance_log_message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。