Fix format issue

This commit is contained in:
2022-04-28 11:18:49 +02:00
parent b347d9025b
commit 3f4a04ab50
2 changed files with 23 additions and 13 deletions

View File

@@ -80,7 +80,7 @@ class BenchmarkTest(unittest.TestCase):
benchmark = Benchmark("accuracy", visualize=False) benchmark = Benchmark("accuracy", visualize=False)
benchmark.compile_results() benchmark.compile_results()
benchmark.save_results() benchmark.save_results()
with patch("sys.stdout", new=StringIO()) as fake_out: with patch("sys.stdout", new=StringIO()):
benchmark.exreport() benchmark.exreport()
self.assertFalse(os.path.exists(Files.exreport_pdf)) self.assertFalse(os.path.exists(Files.exreport_pdf))
self.assertFalse(os.path.exists(Folders.report)) self.assertFalse(os.path.exists(Folders.report))
@@ -116,7 +116,7 @@ class BenchmarkTest(unittest.TestCase):
benchmark = Benchmark("accuracy", visualize=False) benchmark = Benchmark("accuracy", visualize=False)
benchmark.compile_results() benchmark.compile_results()
benchmark.save_results() benchmark.save_results()
with patch("sys.stdout", new=StringIO()) as fake_out: with patch("sys.stdout", new=StringIO()):
benchmark.exreport() benchmark.exreport()
benchmark.excel() benchmark.excel()
file_name = benchmark.get_excel_file_name() file_name = benchmark.get_excel_file_name()

View File

@@ -23,7 +23,8 @@ class SummaryTest(unittest.TestCase):
"date": "2021-09-30", "date": "2021-09-30",
"time": "11:42:07", "time": "11:42:07",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json", "file": "results_accuracy_STree_iMac27_2021-09-30_11:42:07_0"
".json",
"metric": 0.04544339345094904, "metric": 0.04544339345094904,
"duration": 624.2505249977112, "duration": 624.2505249977112,
}, },
@@ -35,7 +36,8 @@ class SummaryTest(unittest.TestCase):
"date": "2022-04-20", "date": "2022-04-20",
"time": "10:52:20", "time": "10:52:20",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_ODTE_Galgo_2022-04-20_10:52:20_0.json", "file": "results_accuracy_ODTE_Galgo_2022-04-20_10:52:20_0."
"json",
"metric": 0.04340676203831255, "metric": 0.04340676203831255,
"duration": 22591.471411943436, "duration": 22591.471411943436,
}, },
@@ -47,7 +49,8 @@ class SummaryTest(unittest.TestCase):
"date": "2021-10-27", "date": "2021-10-27",
"time": "09:40:40", "time": "09:40:40",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json", "file": "results_accuracy_STree_iMac27_2021-10-27_09:40:40_0."
"json",
"metric": 0.04158163842230773, "metric": 0.04158163842230773,
"duration": 3395.009148836136, "duration": 3395.009148836136,
}, },
@@ -59,7 +62,8 @@ class SummaryTest(unittest.TestCase):
"date": "2021-11-01", "date": "2021-11-01",
"time": "19:17:07", "time": "19:17:07",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json", "file": "results_accuracy_STree_macbook-pro_2021-11-01_19:17:"
"07_0.json",
"metric": 0.03789928437296904, "metric": 0.03789928437296904,
"duration": 4115.042420864105, "duration": 4115.042420864105,
}, },
@@ -71,7 +75,8 @@ class SummaryTest(unittest.TestCase):
"date": "2022-01-14", "date": "2022-01-14",
"time": "12:39:30", "time": "12:39:30",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0.json", "file": "results_accuracy_RandomForest_iMac27_2022-01-14_12:39"
":30_0.json",
"metric": 0.03627309062515771, "metric": 0.03627309062515771,
"duration": 272.7363500595093, "duration": 272.7363500595093,
}, },
@@ -93,7 +98,8 @@ class SummaryTest(unittest.TestCase):
"date": "2021-09-30", "date": "2021-09-30",
"time": "11:42:07", "time": "11:42:07",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json", "file": "results_accuracy_STree_iMac27_2021-09-30_11:42:07_0"
".json",
"metric": 0.04544339345094904, "metric": 0.04544339345094904,
"duration": 624.2505249977112, "duration": 624.2505249977112,
}, },
@@ -105,7 +111,8 @@ class SummaryTest(unittest.TestCase):
"date": "2021-10-27", "date": "2021-10-27",
"time": "09:40:40", "time": "09:40:40",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json", "file": "results_accuracy_STree_iMac27_2021-10-27_09:40:40_0"
".json",
"metric": 0.04158163842230773, "metric": 0.04158163842230773,
"duration": 3395.009148836136, "duration": 3395.009148836136,
}, },
@@ -117,7 +124,8 @@ class SummaryTest(unittest.TestCase):
"date": "2021-11-01", "date": "2021-11-01",
"time": "19:17:07", "time": "19:17:07",
"stratified": "0", "stratified": "0",
"file": "results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json", "file": "results_accuracy_STree_macbook-pro_2021-11-01_19:17:"
"07_0.json",
"metric": 0.03789928437296904, "metric": 0.03789928437296904,
"duration": 4115.042420864105, "duration": 4115.042420864105,
}, },
@@ -209,7 +217,7 @@ class SummaryTest(unittest.TestCase):
title = "**Test**" title = "**Test**"
report.show_result(data={}, title=title) report.show_result(data={}, title=title)
computed = fake_out.getvalue() computed = fake_out.getvalue()
expected = f"** **Test** has No data **\n" expected = "** **Test** has No data **\n"
self.assertEqual(computed, expected) self.assertEqual(computed, expected)
def test_best_results_datasets(self): def test_best_results_datasets(self):
@@ -220,13 +228,15 @@ class SummaryTest(unittest.TestCase):
"balance-scale": ( "balance-scale": (
0.83616, 0.83616,
{}, {},
"results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0.json", "results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0."
"json",
"Test default paramters with RandomForest", "Test default paramters with RandomForest",
), ),
"balloons": ( "balloons": (
0.5566666666666668, 0.5566666666666668,
{"max_features": "auto", "splitter": "mutual"}, {"max_features": "auto", "splitter": "mutual"},
"results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json", "results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0."
"json",
"default B", "default B",
), ),
} }