Skip to content
Snippets Groups Projects
Commit 9a18669a authored by Baptiste Bauvin's avatar Baptiste Bauvin
Browse files

Test passing

parent b5f23212
No related branches found
No related tags found
No related merge requests found
Pipeline #3419 passed
...@@ -285,7 +285,7 @@ def get_classic_db_hdf5(views, path_f, name_DB, nb_class, asked_labels_names, ...@@ -285,7 +285,7 @@ def get_classic_db_hdf5(views, path_f, name_DB, nb_class, asked_labels_names,
dataset_name = dataset.get_name() dataset_name = dataset.get_name()
else: else:
pass pass
return dataset_file, labels_dictionary, dataset_name return dataset, labels_dictionary, dataset_name
# #
# def add_gaussian_noise(dataset_file, random_state, path_f, dataset_name, # def add_gaussian_noise(dataset_file, random_state, path_f, dataset_name,
......
...@@ -328,8 +328,7 @@ class Test_execOneBenchmark(unittest.TestCase): ...@@ -328,8 +328,7 @@ class Test_execOneBenchmark(unittest.TestCase):
@classmethod @classmethod
def setUp(cls): def setUp(cls):
rm_tmp() rm_tmp()
print(os.getcwd()) os.mkdir(tmp_path)
os.mkdir("../tests/tmp_tests")
cls.args = { cls.args = {
"Base": {"name": "chicken_is_heaven", "type": "type", "Base": {"name": "chicken_is_heaven", "type": "type",
"pathf": "pathF"}, "pathf": "pathF"},
...@@ -396,7 +395,7 @@ class Test_execOneBenchmark_multicore(unittest.TestCase): ...@@ -396,7 +395,7 @@ class Test_execOneBenchmark_multicore(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
rm_tmp() rm_tmp()
os.mkdir("./tests/tmp_tests") os.mkdir(tmp_path)
cls.args = { cls.args = {
"Base": {"name": "chicken_is_heaven", "type": "type", "Base": {"name": "chicken_is_heaven", "type": "type",
"pathf": "pathF"}, "pathf": "pathF"},
......
...@@ -16,7 +16,7 @@ class Test_initConstants(unittest.TestCase): ...@@ -16,7 +16,7 @@ class Test_initConstants(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
rm_tmp() rm_tmp()
os.mkdir("multiview_platform/tests/tmp_tests") os.mkdir(tmp_path)
cls.view_name="test_dataset" cls.view_name="test_dataset"
cls.datasetFile = h5py.File( cls.datasetFile = h5py.File(
tmp_path+"test.hdf5", "w") tmp_path+"test.hdf5", "w")
...@@ -63,7 +63,7 @@ class Test_initConstants(unittest.TestCase): ...@@ -63,7 +63,7 @@ class Test_initConstants(unittest.TestCase):
tmp_path+"test_dir/test_clf/test_dataset") tmp_path+"test_dir/test_clf/test_dataset")
os.rmdir(tmp_path+"test_dir/test_clf") os.rmdir(tmp_path+"test_dir/test_clf")
os.rmdir(tmp_path+"test_dir") os.rmdir(tmp_path+"test_dir")
os.rmdir("multiview_platform/tests/tmp_tests") os.rmdir(tmp_path)
class Test_initTrainTest(unittest.TestCase): class Test_initTrainTest(unittest.TestCase):
...@@ -103,7 +103,7 @@ class Test_getHPs(unittest.TestCase): ...@@ -103,7 +103,7 @@ class Test_getHPs(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
rm_tmp() rm_tmp()
os.mkdir("multiview_platform/tests/tmp_tests") os.mkdir(tmp_path)
cls.classifierModule = decision_tree cls.classifierModule = decision_tree
cls.hyper_param_search = "randomized_search" cls.hyper_param_search = "randomized_search"
cls.n_iter = 2 cls.n_iter = 2
...@@ -122,10 +122,10 @@ class Test_getHPs(unittest.TestCase): ...@@ -122,10 +122,10 @@ class Test_getHPs(unittest.TestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
for file_name in os.listdir("multiview_platform/tests/tmp_tests"): for file_name in os.listdir(tmp_path):
os.remove( os.remove(
os.path.join("multiview_platform/tests/tmp_tests", file_name)) os.path.join(tmp_path, file_name))
os.rmdir("multiview_platform/tests/tmp_tests") os.rmdir(tmp_path)
def test_simple(self): def test_simple(self):
kwargs, test_folds_predictions = exec_classif_mono_view.getHPs(self.classifierModule, kwargs, test_folds_predictions = exec_classif_mono_view.getHPs(self.classifierModule,
......
...@@ -21,7 +21,7 @@ class Test_get_the_args(unittest.TestCase): ...@@ -21,7 +21,7 @@ class Test_get_the_args(unittest.TestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
os.remove(tmp_path+"config_temp.yml") os.remove(tmp_path+"config_temp.yml")
os.rmdir("multiview_platform/tests/tmp_tests") os.rmdir(tmp_path)
def test_file_loading(self): def test_file_loading(self):
config_dict = configuration.get_the_args(self.path_to_config_file) config_dict = configuration.get_the_args(self.path_to_config_file)
......
...@@ -196,22 +196,22 @@ class Test_genDirecortiesNames(unittest.TestCase): ...@@ -196,22 +196,22 @@ class Test_genDirecortiesNames(unittest.TestCase):
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):
cls.directory = "../chicken_is_heaven/" cls.directory = tmp_path
cls.stats_iter = 5 cls.stats_iter = 5
def test_simple_ovo(cls): def test_simple_ovo(cls):
directories = execution.gen_direcorties_names(cls.directory, directories = execution.gen_direcorties_names(cls.directory,
cls.stats_iter) cls.stats_iter)
cls.assertEqual(len(directories), 5) cls.assertEqual(len(directories), 5)
cls.assertEqual(directories[0], "../chicken_is_heaven/iter_1/") cls.assertEqual(directories[0], os.path.join(tmp_path, "iter_1/"))
cls.assertEqual(directories[-1], "../chicken_is_heaven/iter_5/") cls.assertEqual(directories[-1], os.path.join(tmp_path, "iter_5/"))
def test_ovo_no_iter(cls): def test_ovo_no_iter(cls):
cls.stats_iter = 1 cls.stats_iter = 1
directories = execution.gen_direcorties_names(cls.directory, directories = execution.gen_direcorties_names(cls.directory,
cls.stats_iter) cls.stats_iter)
cls.assertEqual(len(directories), 1) cls.assertEqual(len(directories), 1)
cls.assertEqual(directories[0], "../chicken_is_heaven/") cls.assertEqual(directories[0], tmp_path)
class Test_genArgumentDictionaries(unittest.TestCase): class Test_genArgumentDictionaries(unittest.TestCase):
......
...@@ -18,7 +18,7 @@ class Test_randomized_search(unittest.TestCase): ...@@ -18,7 +18,7 @@ class Test_randomized_search(unittest.TestCase):
rm_tmp() rm_tmp()
cls.random_state = np.random.RandomState(42) cls.random_state = np.random.RandomState(42)
cls.view_weights = [0.5, 0.5] cls.view_weights = [0.5, 0.5]
os.mkdir("multiview_platform/tests/tmp_tests") os.mkdir(tmp_path)
cls.dataset_file = h5py.File( cls.dataset_file = h5py.File(
tmp_path+"test_file.hdf5", "w") tmp_path+"test_file.hdf5", "w")
cls.labels = cls.dataset_file.create_dataset("Labels", cls.labels = cls.dataset_file.create_dataset("Labels",
...@@ -49,10 +49,7 @@ class Test_randomized_search(unittest.TestCase): ...@@ -49,10 +49,7 @@ class Test_randomized_search(unittest.TestCase):
@classmethod @classmethod
def tearDownClass(cls): def tearDownClass(cls):
cls.dataset_file.close() cls.dataset_file.close()
for file_name in os.listdir("multiview_platform/tests/tmp_tests"): rm_tmp()
os.remove(
os.path.join("multiview_platform/tests/tmp_tests", file_name))
os.rmdir("multiview_platform/tests/tmp_tests")
def test_simple(self): def test_simple(self):
......
...@@ -5,8 +5,8 @@ import h5py ...@@ -5,8 +5,8 @@ import h5py
from ..mono_multi_view_classifiers.utils.dataset import Dataset from ..mono_multi_view_classifiers.utils.dataset import Dataset
tmp_path = "multiview_platform/tests/tmp_tests/" tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp_tests/")
test_dataset = Dataset(hdf5_file=h5py.File("multiview_platform/tests/test_database.hdf5", "r")) test_dataset = Dataset(hdf5_file=h5py.File(os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_database.hdf5"), "r"))
def rm_tmp(): def rm_tmp():
try: try:
......
...@@ -52,7 +52,7 @@ def setup_package(): ...@@ -52,7 +52,7 @@ def setup_package():
# dependency_links=['https://github.com/aldro61/pyscm.git#egg=pyscm'], # dependency_links=['https://github.com/aldro61/pyscm.git#egg=pyscm'],
# Une url qui pointe vers la page officielle de votre lib # Une url qui pointe vers la page officielle de votre lib
url='http://github.com/babau1/multiview-machine-learning-omis/', url='http://github.com/babau1/multiview-machine-learning-omis/',
install_requires=['numpy>=1.8', 'scipy>=0.16','scikit-learn==0.19', install_requires=['numpy>=1.16', 'scipy>=0.16','scikit-learn==0.19',
'matplotlib', 'h5py', 'joblib', 'matplotlib', 'h5py', 'joblib',
'pandas', 'm2r', 'pyyaml', 'pyscm @ git+https://github.com/aldro61/pyscm', 'pandas', 'm2r', 'pyyaml', 'pyscm @ git+https://github.com/aldro61/pyscm',
'cvxopt'], 'cvxopt'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment