mirror of
https://github.com/Doctorado-ML/benchmark.git
synced 2025-08-18 00:45:54 +00:00
Complete be_list tests
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
from ...Utils import Folders
|
||||||
from ..TestBase import TestBase
|
from ..TestBase import TestBase
|
||||||
|
|
||||||
|
|
||||||
@@ -18,4 +20,27 @@ class BeListTest(TestBase):
|
|||||||
self.assertEqual(stdout.getvalue(), "** No results found **\n")
|
self.assertEqual(stdout.getvalue(), "** No results found **\n")
|
||||||
|
|
||||||
def test_be_list_nan(self):
|
def test_be_list_nan(self):
|
||||||
pass
|
def swap_files(source_folder, target_folder, file_name):
|
||||||
|
source = os.path.join(source_folder, file_name)
|
||||||
|
target = os.path.join(target_folder, file_name)
|
||||||
|
os.rename(source, target)
|
||||||
|
|
||||||
|
# move nan result from hidden to results
|
||||||
|
file_name = (
|
||||||
|
"results_accuracy_XGBoost_MacBookpro16_2022-05-04_11:00:"
|
||||||
|
"35_0.json"
|
||||||
|
)
|
||||||
|
swap_files(Folders.hidden_results, Folders.results, file_name)
|
||||||
|
try:
|
||||||
|
stdout, stderr = self.execute_script("be_list", ["--nan", "1"])
|
||||||
|
self.assertEqual(stderr.getvalue(), "")
|
||||||
|
self.check_output_file(stdout, "be_list_nan")
|
||||||
|
except Exception:
|
||||||
|
# move back nan result file
|
||||||
|
swap_files(Folders.results, Folders.hidden_results, file_name)
|
||||||
|
self.fail("test_be_list_nan() should not raise exception")
|
||||||
|
|
||||||
|
def test_be_list_nan_no_nan(self):
|
||||||
|
stdout, stderr = self.execute_script("be_list", ["--nan", "1"])
|
||||||
|
self.assertEqual(stderr.getvalue(), "")
|
||||||
|
self.check_output_file(stdout, "be_list_no_nan")
|
||||||
|
13
benchmark/tests/test_files/be_list_nan.test
Normal file
13
benchmark/tests/test_files/be_list_nan.test
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
[94mDate File Score Time(h) Title
|
||||||
|
========== ================================================================ ======== ======= ============================================
|
||||||
|
[96m2022-05-04 results_accuracy_XGBoost_MacBookpro16_2022-05-04_11:00:35_0.json nan 3.091 Default hyperparameters
|
||||||
|
[94m2022-04-20 results_accuracy_ODTE_Galgo_2022-04-20_10:52:20_0.json 0.04341 6.275 Gridsearched hyperparams v022.1b random_init
|
||||||
|
[96m2022-01-14 results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0.json 0.03627 0.076 Test default paramters with RandomForest
|
||||||
|
[94m2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||||
|
[96m2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||||
|
[94m2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
||||||
|
|
||||||
|
****************************** Results with nan moved to hidden ******************************
|
||||||
|
[94mDate File Score Time(h) Title
|
||||||
|
========== ================================================================ ======== ======= =======================
|
||||||
|
[96m2022-05-04 results_accuracy_XGBoost_MacBookpro16_2022-05-04_11:00:35_0.json nan 3.091 Default hyperparameters
|
7
benchmark/tests/test_files/be_list_no_nan.test
Normal file
7
benchmark/tests/test_files/be_list_no_nan.test
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[94mDate File Score Time(h) Title
|
||||||
|
========== =============================================================== ======== ======= ============================================
|
||||||
|
[96m2022-04-20 results_accuracy_ODTE_Galgo_2022-04-20_10:52:20_0.json 0.04341 6.275 Gridsearched hyperparams v022.1b random_init
|
||||||
|
[94m2022-01-14 results_accuracy_RandomForest_iMac27_2022-01-14_12:39:30_0.json 0.03627 0.076 Test default paramters with RandomForest
|
||||||
|
[96m2021-11-01 results_accuracy_STree_macbook-pro_2021-11-01_19:17:07_0.json 0.03790 1.143 default B
|
||||||
|
[94m2021-10-27 results_accuracy_STree_iMac27_2021-10-27_09:40:40_0.json 0.04158 0.943 default A
|
||||||
|
[96m2021-09-30 results_accuracy_STree_iMac27_2021-09-30_11:42:07_0.json 0.04544 0.173 With gridsearched hyperparameters
|
Reference in New Issue
Block a user