def test_strip_any_parameter_with_type_string_that_needs_to_be_stripped(
            self, mock_dictionary_object, expected_result):
        comparator_obj = Setting(mock_dictionary_object)
        input_validator.check_for_parameter_strip(comparator_obj)
        processed_result = comparator_obj.parameters

        assert expected_result == processed_result
    def test_set_parameter(self):
        parameters = mock_input_dict.parameter_with_all_required_key
        setting = Setting(parameters)
        comparable_1 = Compare(order=0)
        comparable_2 = Compare(order=1)
        input_validator.set_parameter(setting, comparable_1, comparable_2)

        for prm_key in parameters:
            if "_1_2_" in prm_key:
                assert getattr(Compare, format_parameter(
                    prm_key, "_1_2_")) == parameters[prm_key]
            elif "_1_" in prm_key:
                assert getattr(comparable_1,
                               format_parameter(prm_key,
                                                "_1_")) == parameters[prm_key]
            elif "_2_" in prm_key:
                assert getattr(comparable_2,
                               format_parameter(prm_key,
                                                "_2_")) == parameters[prm_key]
            else:
                assert False
 def test_parameter_value_type_checking_when_everything_is_correct(self):
     comparator_obj = Setting(
         mock_input_dict.parameter_with_existing_keys_for_type_checking)
     assert input_validator.check_for_parameter_type(comparator_obj) is None
 def test_when_parameter_is_of_type_list_but_boolean_has_been_submitted(
         self):
     comparator_obj = Setting(
         mock_input_dict.parameter_is_list_but_boolean_is_submitted)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_parameter_type(comparator_obj)
 def test_to_check_any_parameters_of_type_string_to_have_value_of_string_type(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     assert input_validator.check_for_type_string(comparator_obj) is None
 def test_when_the_file_has_all_the_required_keys(self):
     comparator_obj = Setting(
         mock_input_dict.parameter_with_all_required_key)
     assert input_validator.check_for_required_key(comparator_obj) is None
 def test_parameter_keys_to_be_string_while_user_has_submitted_right_key_type(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     assert input_validator.check_for_key_to_be_string_type(
         comparator_obj) is None
 def test_set_default(self):
     parameters = mock_input_dict.parameter_with_all_required_key
     setting = Setting(parameters)
     input_validator.set_default(setting)
 def test_when_the_parameter_list_is_not_empty(self):
     comparator_obj = Setting(
         mock_input_dict.parameter_with_some_key_value_pair)
     assert input_validator.check_for_empty_dictionary(
         comparator_obj) is None
 def test_check_exception_raise_when_user_submits_a_key_that_does_not_exist_in_default_schema(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_default_schema(comparator_obj)
 def test_should_not_raise_error_if_key_is_not_required_but_value_is_empty(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     assert input_validator.check_for_empty_value(comparator_obj) is None
    def test_when_required_parameter_value_is_empty(self,
                                                    mock_dictionary_object):
        comparator_obj = Setting(mock_dictionary_object)

        with pytest.raises(AppErrorHandler):
            input_validator.check_for_empty_value(comparator_obj)
 def test_should_not_raise_error_if_submitted_parameter_does_not_have_string_value(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     assert input_validator.check_for_special_character(
         comparator_obj) is None
 def test_exception_raise_when_special_characters_are_in_parameter_that_can_not_have_any_special_char(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_special_character(comparator_obj)
 def test_to_check_if_none_string_types_are_escaped_for_any_parameter_with_string_type_and_requiring_stripping(
         self, mock_dictionary_object, expected_result):
     comparator_obj = Setting(mock_dictionary_object)
     input_validator.check_for_parameter_strip(comparator_obj)
     processed_result = comparator_obj.parameters
     assert expected_result == processed_result
 def test_when_user_submits_parameter_that_is_a_dictionary(self):
     comparator_obj = Setting(mock_input_dict.parameter_with_type_dict)
     assert input_validator.check_for_type_dictionary(
         comparator_obj) is None
 def test_when_the_parameter_list_is_empty(self):
     comparator_obj = Setting(mock_input_dict.parameter_with_no_value)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_empty_dictionary(comparator_obj)
 def test_exception_raise_when_user_submits_keys_that_do_exist_in_default_schema(
         self):
     comparator_obj = Setting(mock_input_dict.parameter_with_existing_keys)
     assert input_validator.check_for_default_schema(comparator_obj) is None
    def test_when_user_submits_wrong_parameter_values_type(
            self, mock_dictionary_object):
        comparator_obj = Setting(mock_dictionary_object)

        with pytest.raises(AppErrorHandler):
            input_validator.check_for_parameter_type(comparator_obj)
 def test_when_user_submits_parameter_that_is_not_of_type_dictionary(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_type_dictionary(comparator_obj)
 def test_parameter_keys_to_be_string_while_user_has_submitted_wrong_key_type(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_key_to_be_string_type(comparator_obj)
 def test_when_submitted_parameter_key_is_not_available_for_checking_parameter_value_type(
         self):
     comparator_obj = Setting(mock_input_dict.parameter_with_existing_keys)
     assert input_validator.check_for_parameter_type(comparator_obj) is None
 def test_when_required_parameter_key_is_missing(self):
     comparator_obj = Setting(
         mock_input_dict.parameter_with_missing_required_key)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_required_key(comparator_obj)
 def test_when_submitted_parameter_for_checking_value_type_has_empty_string(
         self):
     comparator_obj = Setting(
         mock_input_dict.parameter_is_boolean_but_empty_string_is_submitted)
     assert input_validator.check_for_parameter_type(comparator_obj) is None
def export_to_excel(user_parameters):
    setting = Setting(user_parameters)
    comparable = [Compare(order=0), Compare(order=1)]
    # #############################################################################################
    input_validator.check_for_type_dictionary(setting)
    input_validator.check_for_empty_dictionary(setting)
    input_validator.check_for_key_to_be_string_type(setting)
    input_validator.check_for_required_key(setting)
    input_validator.check_for_type_string(setting)
    input_validator.check_for_parameter_strip(setting)
    input_validator.check_for_special_character(setting)
    input_validator.check_for_empty_value(setting)
    input_validator.check_for_default_schema(setting)
    input_validator.check_for_parameter_type(setting)
    # TODO need to validation the map_columns
    # TODO need to validation the index_column
    input_validator.set_default(setting)
    input_validator.set_parameter(setting, comparable[0], comparable[1])
    input_validator.check_for_input_file_existence(comparable)
    input_validator.check_for_file_read_access(comparable)
    input_validator.check_for_file_write_access(comparable)
    input_validator.check_for_file_size(comparable)
    input_validator.set_file_encoding(comparable)
    input_validator.check_for_file_encoding(comparable)
    input_validator.check_for_delimiter(comparable)
    # #############################################################################################
    header_validator.check_for_negative_header_row(comparable)
    header_validator.check_for_header_row_location(comparable)
    header_validator.set_original_header(comparable)
    header_validator.set_header(comparable)
    header_validator.strip_header(comparable)
    header_validator.check_for_index_name_existence(comparable)
    header_validator.set_index_column_location(comparable)
    header_validator.check_for_index_column(comparable)
    header_validator.check_for_map_column_existence(comparable)
    header_validator.set_map_column_location(comparable)
    header_validator.check_for_map_column(comparable)

    header_validator.format_index_column(comparable)
    header_validator.format_map_column(comparable)
    header_validator.format_unnamed_column(comparable)
    header_validator.format_duplicate_column(comparable)
    header_validator.format_disjunctive_column(comparable[0], comparable[1])
    header_validator.format_disjunctive_column(comparable[1], comparable[0])
    header_validator.format_not_for_checked_column(comparable)
    header_validator.set_index_column_number(comparable)
    header_validator.set_regular_column_number(comparable)
    header_validator.set_not_checked_column_number(comparable)
    header_validator.set_map_column_number(comparable)
    header_validator.set_disjunctive_column_number(comparable)
    header_validator.set_duplicate_column_number(comparable)
    header_validator.set_unnamed_column_number(comparable)
    header_validator.set_start_column(comparable[0], comparable[1])
    header_validator.set_end_column(comparable)
    header_validator.set_start_end_index_column(comparable)
    header_validator.set_start_end_checked_column(comparable)
    header_validator.set_start_end_not_checked_column(comparable)
    header_validator.set_start_end_disjunctive_column(comparable)
    header_validator.set_start_end_duplicate_column(comparable)
    header_validator.set_start_end_unnamed_column(comparable)
    # #############################################################################################
    data_importer.import_file(comparable)
    data_importer.freeze_pandas_index(comparable)
    data_importer.set_data_frame(comparable)
    data_importer.extract_not_checked_column(comparable)
    data_importer.extract_disjunctive_column(comparable)
    data_importer.extract_duplicate_column(comparable)
    data_importer.extract_unnamed_column(comparable)
    data_importer.drop_not_checked_column(comparable)
    data_importer.drop_disjunctive_column(comparable)
    data_importer.drop_duplicate_column(comparable)
    data_importer.drop_unnamed_column(comparable)
    # #############################################################################################
    index_validator.stringify_index(comparable)
    index_validator.sort_index(comparable)
    index_validator.strip_index(comparable)
    index_validator.check_for_empty_index(comparable)
    index_validator.drop_empty_index(comparable)
    index_validator.check_for_duplicate_index(comparable)
    index_validator.drop_duplicate_index(comparable)
    index_validator.check_for_disjunctive_index(comparable[0], comparable[1])
    index_validator.check_for_disjunctive_index(comparable[1], comparable[0])
    index_validator.drop_disjunctive_index(comparable)
    # #############################################################################################
    cell_comparator.validate_index_identity(comparable[0], comparable[1])
    # TODO need to add validate column names identity ( all the columns in a must be in b except index column)
    cell_comparator.remove_nan(comparable)
    cell_comparator.remove_non_printable_char(comparable)
    cell_comparator.remove_white_space_char(comparable)
    cell_comparator.copy_df_to_trimmed_df(comparable)

    # TODO need to add check_for_identical_row
    # TODO need to add drop_identical_row
    # TODO add find differences
    # TODO generate final frame (index, checked, not checked, dis, dup, un, identical row, mod row)
    # #############################################################################################

    data_exporter.create_name_for_output_file(comparable[0], comparable[1])
    data_exporter.create_excel_workbook()
    data_exporter.create_excel_worksheet()
    data_exporter.add_local_excel_format(comparable)
    data_exporter.apply_column_general_format(comparable)
    data_exporter.write_file_name_label()
    data_exporter.write_file_name_title(comparable)
    data_exporter.write_column_type_label()
    data_exporter.write_index_column_type_title(comparable)
    data_exporter.write_checked_column_type_title(comparable)
    data_exporter.write_not_checked_column_type_title(comparable)
    data_exporter.write_disjunctive_column_type_title(comparable)
    data_exporter.write_duplicate_column_type_title(comparable)
    data_exporter.write_unnamed_column_type_title(comparable)

    data_exporter.apply_checked_column_hide_condition(comparable)
    data_exporter.apply_not_checked_column_hide_condition(comparable)
    data_exporter.apply_disjunctive_column_hide_condition(comparable)
    data_exporter.apply_duplicate_column_hide_condition(comparable)
    data_exporter.apply_unnamed_column_hide_condition(comparable)

    data_exporter.write_column_name_label()
    data_exporter.write_index_column_name(comparable)
    data_exporter.write_checked_column_name(comparable)
    data_exporter.write_not_checked_column_name(comparable)
    data_exporter.write_disjunctive_column_name(comparable)
    data_exporter.write_duplicate_column_name(comparable)
    data_exporter.write_unnamed_column_name(comparable)
    data_exporter.close_excel_workbook()
 def test_to_check_any_parameters_of_type_string_to_have_value_of_string_type_while_user_submitted_other_types(
         self, mock_dictionary_object):
     comparator_obj = Setting(mock_dictionary_object)
     with pytest.raises(AppErrorHandler):
         input_validator.check_for_type_string(comparator_obj)