Exemple #1
0
def main(args):
    if args.verbose:
        logger.setLevel(logging.DEBUG)
    logger.debug(args)
    mf = Masterfile.find_settings_file_and_construct(args.masterfile_path)
    mf._find_candidate_data_files()
    mf._candidate_data_files.extend(args.file)
    mf._read_unprocessed_data_files()
    mf._process_dataframes()
    mf._load_dictionary()
    errors = validator.run_all_validators(mf)
    for e in errors:
        print(e.message)
        for loc in e.locations:
            print('  {}'.format(loc.format(True)))
    if errors:
        return ERRORS
    else:
        print("No problems found!")
    return CLEAN
 def test_problems_path_has_component_not_in_dictionary_error(
         self, full_problems_mf):
     ers = validator.run_all_validators(full_problems_mf)
     assert instance_filter(ers, errors.ComponentNotInDictionaryError)
 def test_problems_path_has_dictionary_index_error(self, full_problems_mf):
     ers = validator.run_all_validators(full_problems_mf)
     assert instance_filter(ers, errors.DictionaryIndexNotFoundError)
 def test_problems_path_has_duplicate_error(self, problems_mf):
     ers = validator.run_all_validators(problems_mf)
     assert instance_filter(ers, errors.DuplicateColumnError)
 def test_problems_path_has_column_format_error(self, problems_mf):
     ers = validator.run_all_validators(problems_mf)
     assert instance_filter(ers, errors.ColumnFormatError)
 def test_probelms_path_has_missing_index_value_error(self, problems_mf):
     assert instance_filter(validator.run_all_validators(problems_mf),
                            errors.MissingIndexValueError)
 def test_probelms_path_has_duplicate_index_error(self, problems_mf):
     assert instance_filter(validator.run_all_validators(problems_mf),
                            errors.DuplicateIndexValueError)
 def test_problems_path_has_index_error(self, problems_mf):
     ers = validator.run_all_validators(problems_mf)
     assert instance_filter(ers, errors.IndexNotFoundError)
 def test_example_path_has_ioerror(self, nosettings_mf):
     ers = validator.run_all_validators(nosettings_mf)
     assert instance_filter(ers, errors.IOError)
 def test_good_path_has_no_errors(self, good_mf):
     ers = validator.run_all_validators(good_mf)
     assert len(ers) == 0