From a6da525b9cac4f1f071a9aa7818a4de21f2cd441 Mon Sep 17 00:00:00 2001 From: davidgirdwood1 <162387981+davidgirdwood1@users.noreply.github.com> Date: Mon, 24 Feb 2025 15:25:54 -0800 Subject: [PATCH 1/2] Don't display result if INIT_STATE_TEST --- codeflash/github/PrComment.py | 12 ++++++++---- codeflash/verification/test_results.py | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/codeflash/github/PrComment.py b/codeflash/github/PrComment.py index 76a19f5e7..a9b11b5c2 100644 --- a/codeflash/github/PrComment.py +++ b/codeflash/github/PrComment.py @@ -20,6 +20,13 @@ class PrComment: winning_benchmarking_test_results: TestResults def to_json(self) -> dict[str, Union[dict[str, dict[str, int]], int, str]]: + + report_table = { + test_type.to_name(): result + for test_type, result in self.winning_behavioral_test_results.get_test_pass_fail_report_by_type().items() + if test_type.should_display_result() + } + return { "optimization_explanation": self.optimization_explanation, "best_runtime": humanize_runtime(self.best_runtime), @@ -29,10 +36,7 @@ def to_json(self) -> dict[str, Union[dict[str, dict[str, int]], int, str]]: "speedup_x": self.speedup_x, "speedup_pct": self.speedup_pct, "loop_count": self.winning_benchmarking_test_results.number_of_loops(), - "report_table": { - test_type.to_name(): result - for test_type, result in self.winning_behavioral_test_results.get_test_pass_fail_report_by_type().items() - }, + "report_table": report_table } diff --git a/codeflash/verification/test_results.py b/codeflash/verification/test_results.py index 28d8bfc0d..c2c99d3cf 100644 --- a/codeflash/verification/test_results.py +++ b/codeflash/verification/test_results.py @@ -30,6 +30,9 @@ class TestType(Enum): CONCOLIC_COVERAGE_TEST = 5 INIT_STATE_TEST = 6 + def should_display(self) -> bool: + return self != TestType.INIT_STATE_TEST + def to_name(self) -> str: if self == TestType.INIT_STATE_TEST: return "" From 488d4fac00df885cdd3ef7c2f13662bc5b5a93b3 Mon Sep 17 00:00:00 2001 From: davidgirdwood1 <162387981+davidgirdwood1@users.noreply.github.com> Date: Mon, 24 Feb 2025 16:10:50 -0800 Subject: [PATCH 2/2] Use the to_name() --- codeflash/github/PrComment.py | 2 +- codeflash/verification/test_results.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/codeflash/github/PrComment.py b/codeflash/github/PrComment.py index a9b11b5c2..a6f6aa892 100644 --- a/codeflash/github/PrComment.py +++ b/codeflash/github/PrComment.py @@ -24,7 +24,7 @@ def to_json(self) -> dict[str, Union[dict[str, dict[str, int]], int, str]]: report_table = { test_type.to_name(): result for test_type, result in self.winning_behavioral_test_results.get_test_pass_fail_report_by_type().items() - if test_type.should_display_result() + if test_type.to_name() } return { diff --git a/codeflash/verification/test_results.py b/codeflash/verification/test_results.py index c2c99d3cf..28d8bfc0d 100644 --- a/codeflash/verification/test_results.py +++ b/codeflash/verification/test_results.py @@ -30,9 +30,6 @@ class TestType(Enum): CONCOLIC_COVERAGE_TEST = 5 INIT_STATE_TEST = 6 - def should_display(self) -> bool: - return self != TestType.INIT_STATE_TEST - def to_name(self) -> str: if self == TestType.INIT_STATE_TEST: return ""