# Path: wallace/settings.py
# class AbstractSettings(object):
#     DESCRIPTIONS = {
#             "fitness_evaluation.crossfold_partitions": "Default number of partitions (k) to use when doing k-fold cross validation.",
#             "fitness_evaluation.evaluation_method": "Default method for evaluating the fitness of a model.",
#             "model_tracking.models_to_track": "Specify the number of the best models to return after the run has completed.",
#             "optimization_algorithm_tracking.tracking_log_filename": "The file which all tracking on the optimization algorithm will be written to.",
#             "optimization_algorithm_tracking.final_results_filename": "The file where the final results will be output to.",
#             "dataset.maximum_dataset_size": "When reading in a dataset, this is the maximum number of rows allowed.",
#             "dataset.randomize_file_reader": "If a file has more rows than `dataset.maximum_dataset_size` allows, then read in all of rows and randomly choose the rows to keep.",
#             "dataset.remove_rows_with_missing_data": "Remove a row if it has missing data.",
#             "dataset.maximum_missing_data_percentage": "Columns with a percentage of missing data higher than this value will be considered sparse, i.e. rows with missing data will not be removed when missing data appears in a sparse column.",
#             "dataset_transformation.transform_datasets": "Perform the default transformations defined in `dataset_transformations.default_transformations` on a dataset when it is being read into memory.",
#             "dataset_transformation.log_transformation_base": "Default base for performing a log transformation.",
#             "dataset_transformation.default_transformations": "Transformations to be applied to a dataset automatically if `dataset_transformation.transform_datasets` is True.",
#             "differential_evolution.crossover_probability": "The probability of mutating a given value in differential evolution (CR).",
#             "differential_evolution.differential_weight": "Used for weighting differences in differential evolution (F).",
#             "optimization_algorithm.population_size": "Default number of models in the population for a given step of an optimization algorithm.",
#             "optimization_algorithm.finishing_criteria.max_steps": "Number of steps for an optimization algorithm to run before it finishes.",
#             "optimization_algorithm.default_stages": "The default OptimizationAlgorithmStages to use in an optimization algorithm.",
#             "independent_variable_selection.initial_independent_variables_percentage": "Percentage of total number of variables to start with when initializing an optimization algorithm."
#         }
#     DEFAULTS = {
#             "fitness_evaluation.crossfold_partitions": 3,
#             "fitness_evaluation.evaluation_method": MeanSquaredError,
#             "model_tracking.models_to_track": 50,
#             "optimization_algorithm_tracking.tracking_log_filename": "optimization_algorithm_logs.log",
#             "optimization_algorithm_tracking.final_results_filename": None,
#             "dataset.maximum_dataset_size": 50000,
#             "dataset.randomize_file_reader": False,
#             "dataset.remove_rows_with_missing_data": True,
#             "dataset.maximum_missing_data_percentage": 0.15,
#             "dataset_transformation.transform_datasets": False,
#             "dataset_transformation.log_transformation_base": 10,
#             "dataset_transformation.default_transformations": [LogTransformation, ScaleTransformation, SqrtTransformation, BoxCoxTransformation],
#             "differential_evolution.crossover_probability": 0.5,
#             "differential_evolution.differential_weight": 0.8,
#             "optimization_algorithm.population_size": 40,
#             "optimization_algorithm.finishing_criteria.max_steps": 200,
#             "optimization_algorithm.default_stages": {
#                 InitializationStage: (0, 0.3),
#                 ComputationStage: (0.3, 1)
#                 },
#             "independent_variable_selection.initial_independent_variables_percentage": 0.25
#         }
#     def __init__(self, settings=None):
#     def _resolve_attribute(self, attribute, *args):
#     def set(self, attribute_name, value):
#     def get(self, attribute_name, *args):
#     def list_setting_names(self):
#     def get_description(self, attribute_name):
#     def has(self, attribute_name):
#     def set_default(klass, attribute_name, value):


from unittest import TestCase
from wallace import settings
from .fixtures import *
        self.assertEqual(3, settings_object.get("setting_3"))

    def test_default_settings_get_overridden(self):
        new_settings = {
            "setting_1": 5,
            "setting_4": 10
            }
        settings_object = settings.AbstractSettings(new_settings)

        self.assertEqual(5, settings_object.get("setting_1"))
        self.assertEqual(2, settings_object.get("setting_2"))
        self.assertEqual(3, settings_object.get("setting_3"))
        self.assertEqual(10, settings_object.get("setting_4"))

    def test_setting_a_function(self):
        new_settings = {
            "setting_1": lambda : 15,
            "setting_2": lambda x : x
            }
        settings_object = settings.AbstractSettings(new_settings)

        self.assertEqual(15, settings_object.get("setting_1"))
        self.assertEqual(10, settings_object.get("setting_2", 10))
        self.assertEqual(20, settings_object.get("setting_2", 20))
        self.assertEqual(3, settings_object.get("setting_3"))

    def test_setting_a_function_with_multiple_arguments(self):
        new_settings = {
            "setting_1": lambda x, y, z : x + y + z
            }

# Path: wallace/settings.py
# class AbstractSettings(object):
#     DESCRIPTIONS = {
#             "fitness_evaluation.crossfold_partitions": "Default number of partitions (k) to use when doing k-fold cross validation.",
#             "fitness_evaluation.evaluation_method": "Default method for evaluating the fitness of a model.",
#             "model_tracking.models_to_track": "Specify the number of the best models to return after the run has completed.",
#             "optimization_algorithm_tracking.tracking_log_filename": "The file which all tracking on the optimization algorithm will be written to.",
#             "optimization_algorithm_tracking.final_results_filename": "The file where the final results will be output to.",
#             "dataset.maximum_dataset_size": "When reading in a dataset, this is the maximum number of rows allowed.",
#             "dataset.randomize_file_reader": "If a file has more rows than `dataset.maximum_dataset_size` allows, then read in all of rows and randomly choose the rows to keep.",
#             "dataset.remove_rows_with_missing_data": "Remove a row if it has missing data.",
#             "dataset.maximum_missing_data_percentage": "Columns with a percentage of missing data higher than this value will be considered sparse, i.e. rows with missing data will not be removed when missing data appears in a sparse column.",
#             "dataset_transformation.transform_datasets": "Perform the default transformations defined in `dataset_transformations.default_transformations` on a dataset when it is being read into memory.",
#             "dataset_transformation.log_transformation_base": "Default base for performing a log transformation.",
#             "dataset_transformation.default_transformations": "Transformations to be applied to a dataset automatically if `dataset_transformation.transform_datasets` is True.",
#             "differential_evolution.crossover_probability": "The probability of mutating a given value in differential evolution (CR).",
#             "differential_evolution.differential_weight": "Used for weighting differences in differential evolution (F).",
#             "optimization_algorithm.population_size": "Default number of models in the population for a given step of an optimization algorithm.",
#             "optimization_algorithm.finishing_criteria.max_steps": "Number of steps for an optimization algorithm to run before it finishes.",
#             "optimization_algorithm.default_stages": "The default OptimizationAlgorithmStages to use in an optimization algorithm.",
#             "independent_variable_selection.initial_independent_variables_percentage": "Percentage of total number of variables to start with when initializing an optimization algorithm."
#         }
#     DEFAULTS = {
#             "fitness_evaluation.crossfold_partitions": 3,
#             "fitness_evaluation.evaluation_method": MeanSquaredError,
#             "model_tracking.models_to_track": 50,
#             "optimization_algorithm_tracking.tracking_log_filename": "optimization_algorithm_logs.log",
#             "optimization_algorithm_tracking.final_results_filename": None,
#             "dataset.maximum_dataset_size": 50000,
#             "dataset.randomize_file_reader": False,
#             "dataset.remove_rows_with_missing_data": True,
#             "dataset.maximum_missing_data_percentage": 0.15,
#             "dataset_transformation.transform_datasets": False,
#             "dataset_transformation.log_transformation_base": 10,
#             "dataset_transformation.default_transformations": [LogTransformation, ScaleTransformation, SqrtTransformation, BoxCoxTransformation],
#             "differential_evolution.crossover_probability": 0.5,
#             "differential_evolution.differential_weight": 0.8,
#             "optimization_algorithm.population_size": 40,
#             "optimization_algorithm.finishing_criteria.max_steps": 200,
#             "optimization_algorithm.default_stages": {
#                 InitializationStage: (0, 0.3),
#                 ComputationStage: (0.3, 1)
#                 },
#             "independent_variable_selection.initial_independent_variables_percentage": 0.25
#         }
#     def __init__(self, settings=None):
#     def _resolve_attribute(self, attribute, *args):
#     def set(self, attribute_name, value):
#     def get(self, attribute_name, *args):
#     def list_setting_names(self):
#     def get_description(self, attribute_name):
#     def has(self, attribute_name):
#     def set_default(klass, attribute_name, value):


# Path: tests/settings/tests.py
from unittest import TestCase
from wallace import settings
from .fixtures import *

        self.assertEqual(3, settings_object.get("setting_3"))

    def test_default_settings_get_overridden(self):
        new_settings = {
            "setting_1": 5,
            "setting_4": 10
            }
        settings_object = settings.AbstractSettings(new_settings)

        self.assertEqual(5, settings_object.get("setting_1"))
        self.assertEqual(2, settings_object.get("setting_2"))
        self.assertEqual(3, settings_object.get("setting_3"))
        self.assertEqual(10, settings_object.get("setting_4"))

    def test_setting_a_function(self):
        new_settings = {
            "setting_1": lambda : 15,
            "setting_2": lambda x : x
            }
        settings_object = settings.AbstractSettings(new_settings)

        self.assertEqual(15, settings_object.get("setting_1"))
        self.assertEqual(10, settings_object.get("setting_2", 10))
        self.assertEqual(20, settings_object.get("setting_2", 20))
        self.assertEqual(3, settings_object.get("setting_3"))

    def test_setting_a_function_with_multiple_arguments(self):
        new_settings = {
            "setting_1": lambda x, y, z : x + y + z
            }

        settings_object = settings.AbstractSettings(new_settings)