Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions codeflash/github/PrComment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need the extra method here, we can just inline it in the comprehension directly. i.e

        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.to_name()
        }
        

return {
"optimization_explanation": self.optimization_explanation,
"best_runtime": humanize_runtime(self.best_runtime),
Expand All @@ -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
}


Expand Down
3 changes: 3 additions & 0 deletions codeflash/verification/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down
Loading