From 384053efe5d076fa9a3ff45de1263f01edfec2de Mon Sep 17 00:00:00 2001 From: Nordine67200 Date: Thu, 2 Feb 2023 17:01:47 +0100 Subject: [PATCH] issue 297: Update format of the report scores --- .../reports/multi_table/quality_report.py | 6 +++--- .../reports/single_table/quality_report.py | 6 +++--- .../test_multi_table_quality_report.py | 18 +++++++++--------- .../test_single_table_quality_report.py | 12 ++++++------ 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/sdmetrics/reports/multi_table/quality_report.py b/sdmetrics/reports/multi_table/quality_report.py index e47512b6..49c6a373 100644 --- a/sdmetrics/reports/multi_table/quality_report.py +++ b/sdmetrics/reports/multi_table/quality_report.py @@ -52,11 +52,11 @@ def _print_results(self, out=sys.stdout): for prop, score in self._property_breakdown.items(): if not pd.isna(score): - out.write(f'{prop}: {round(score * 100, 2)}%\n') + out.write(f'- {prop}: {round(score * 100, 2)}%\n') elif self._property_errors[prop] > 0: - out.write(f'{prop}: Error computing property.\n') + out.write(f'- {prop}: Error computing property.\n') else: - out.write(f'{prop}: NaN\n') + out.write(f'- {prop}: NaN\n') def generate(self, real_data, synthetic_data, metadata, verbose=True): """Generate report. diff --git a/sdmetrics/reports/single_table/quality_report.py b/sdmetrics/reports/single_table/quality_report.py index 770ca0b8..09193b5c 100644 --- a/sdmetrics/reports/single_table/quality_report.py +++ b/sdmetrics/reports/single_table/quality_report.py @@ -48,11 +48,11 @@ def _print_results(self, out=sys.stdout): for prop, score in self._property_breakdown.items(): if not pd.isna(score): - out.write(f'{prop}: {round(score * 100, 2)}%\n') + out.write(f'- {prop}: {round(score * 100, 2)}%\n') elif self._property_errors[prop] > 0: - out.write(f'{prop}: Error computing property.\n') + out.write(f'- {prop}: Error computing property.\n') else: - out.write(f'{prop}: NaN\n') + out.write(f'- {prop}: NaN\n') def generate(self, real_data, synthetic_data, metadata, verbose=True): """Generate report. diff --git a/tests/unit/reports/multi_table/test_multi_table_quality_report.py b/tests/unit/reports/multi_table/test_multi_table_quality_report.py index 1cf2ff0f..16fffae2 100644 --- a/tests/unit/reports/multi_table/test_multi_table_quality_report.py +++ b/tests/unit/reports/multi_table/test_multi_table_quality_report.py @@ -1224,9 +1224,9 @@ def test__print_result(self): mock_out.write.assert_has_calls([ call('\nOverall Quality Score: 80.0%\n\n'), call('Properties:\n'), - call('Column Shapes: 60.0%\n'), - call('Column Pair Trends: 80.0%\n'), - call('Parent Child Relationships: 90.0%\n'), + call('- Column Shapes: 60.0%\n'), + call('- Column Pair Trends: 80.0%\n'), + call('- Parent Child Relationships: 90.0%\n'), ]) def test__print_result_with_error(self): @@ -1262,9 +1262,9 @@ def test__print_result_with_error(self): mock_out.write.assert_has_calls([ call('\nOverall Quality Score: 70.0%\n\n'), call('Properties:\n'), - call('Column Shapes: 60.0%\n'), - call('Column Pair Trends: Error computing property.\n'), - call('Parent Child Relationships: 80.0%\n'), + call('- Column Shapes: 60.0%\n'), + call('- Column Pair Trends: Error computing property.\n'), + call('- Parent Child Relationships: 80.0%\n'), ]) def test__print_result_with_all_errors(self): @@ -1300,7 +1300,7 @@ def test__print_result_with_all_errors(self): mock_out.write.assert_has_calls([ call('\nOverall Quality Score: Error computing report.\n\n'), call('Properties:\n'), - call('Column Shapes: Error computing property.\n'), - call('Column Pair Trends: Error computing property.\n'), - call('Parent Child Relationships: Error computing property.\n'), + call('- Column Shapes: Error computing property.\n'), + call('- Column Pair Trends: Error computing property.\n'), + call('- Parent Child Relationships: Error computing property.\n'), ]) diff --git a/tests/unit/reports/single_table/test_single_table_quality_report.py b/tests/unit/reports/single_table/test_single_table_quality_report.py index ccabab5d..ca868cdf 100644 --- a/tests/unit/reports/single_table/test_single_table_quality_report.py +++ b/tests/unit/reports/single_table/test_single_table_quality_report.py @@ -811,8 +811,8 @@ def test__print_result(self): mock_out.write.assert_has_calls([ call('\nOverall Quality Score: 70.0%\n\n'), call('Properties:\n'), - call('Column Shapes: 60.0%\n'), - call('Column Pair Trends: 80.0%\n'), + call('- Column Shapes: 60.0%\n'), + call('- Column Pair Trends: 80.0%\n'), ]) def test__print_result_with_error(self): @@ -840,8 +840,8 @@ def test__print_result_with_error(self): mock_out.write.assert_has_calls([ call('\nOverall Quality Score: 60.0%\n\n'), call('Properties:\n'), - call('Column Shapes: 60.0%\n'), - call('Column Pair Trends: Error computing property.\n'), + call('- Column Shapes: 60.0%\n'), + call('- Column Pair Trends: Error computing property.\n'), ]) def test__print_result_with_all_errors(self): @@ -869,6 +869,6 @@ def test__print_result_with_all_errors(self): mock_out.write.assert_has_calls([ call('\nOverall Quality Score: Error computing report.\n\n'), call('Properties:\n'), - call('Column Shapes: Error computing property.\n'), - call('Column Pair Trends: Error computing property.\n'), + call('- Column Shapes: Error computing property.\n'), + call('- Column Pair Trends: Error computing property.\n'), ])