當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。