# Path: xcessiv/functions.py
# def hash_file(path, block_size=65536):
# def hash_string(string):
# def import_object_from_path(path, object):
# def import_object_from_string_code(code, object):
# def import_string_code_as_module(code):
# def verify_dataset(X, y):
# def is_valid_json(x):
# def make_serializable(json):
# def get_sample_dataset(dataset_properties):
# def verify_estimator_class(est, meta_feature_generator, metric_generators, dataset_properties):
# def get_path_from_query_string(req):
#     def __init__(self, path):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# class DBContextManager():
# 
# Path: xcessiv/presets/metricsetting.py



import unittest
import numpy as np
from sklearn.datasets import load_iris, load_breast_cancer, load_boston
from sklearn.linear_model import LogisticRegression, LinearRegression
from sklearn.model_selection import cross_val_predict
from xcessiv import functions
from xcessiv.presets import metricsetting

class TestMAE(unittest.TestCase):
    def test_source(self):
        module = functions.import_string_code_as_module(metricsetting.mae['source'])

        assert np.round(module.metric_generator(regression_y, regression_preds), 2) == 6.99

        del module


class TestMSE(unittest.TestCase):
    def test_source(self):
        module = functions.import_string_code_as_module(metricsetting.mse['source'])

        assert np.round(module.metric_generator(regression_y, regression_preds), 2) == 168.09

        del module


class TestMedianAbsoluteError(unittest.TestCase):
    def test_source(self):
        module = functions.import_string_code_as_module(metricsetting.median_absolute_error['source'])

        assert np.round(module.metric_generator(regression_y, regression_preds), 2) == 3.72

        del module


class TestR2Score(unittest.TestCase):
    def test_source(self):

# Path: xcessiv/functions.py
# def hash_file(path, block_size=65536):
# def hash_string(string):
# def import_object_from_path(path, object):
# def import_object_from_string_code(code, object):
# def import_string_code_as_module(code):
# def verify_dataset(X, y):
# def is_valid_json(x):
# def make_serializable(json):
# def get_sample_dataset(dataset_properties):
# def verify_estimator_class(est, meta_feature_generator, metric_generators, dataset_properties):
# def get_path_from_query_string(req):
#     def __init__(self, path):
#     def __enter__(self):
#     def __exit__(self, exc_type, exc_val, exc_tb):
# class DBContextManager():
# 
# Path: xcessiv/presets/metricsetting.py



# Path: xcessiv/presets/tests/test_metricsetting.py
import unittest
import numpy as np
from sklearn.datasets import load_iris, load_breast_cancer, load_boston
from sklearn.linear_model import LogisticRegression, LinearRegression
from sklearn.model_selection import cross_val_predict
from xcessiv import functions
from xcessiv.presets import metricsetting


class TestMAE(unittest.TestCase):
    def test_source(self):
        module = functions.import_string_code_as_module(metricsetting.mae['source'])

        assert np.round(module.metric_generator(regression_y, regression_preds), 2) == 6.99

        del module


class TestMSE(unittest.TestCase):
    def test_source(self):
        module = functions.import_string_code_as_module(metricsetting.mse['source'])

        assert np.round(module.metric_generator(regression_y, regression_preds), 2) == 168.09

        del module


class TestMedianAbsoluteError(unittest.TestCase):
    def test_source(self):
        module = functions.import_string_code_as_module(metricsetting.median_absolute_error['source'])

        assert np.round(module.metric_generator(regression_y, regression_preds), 2) == 3.72

        del module


class TestR2Score(unittest.TestCase):
    def test_source(self):

        module = functions.import_string_code_as_module(metricsetting.r2_score['source'])