def test_queries(test_label, query_input_file, query_output_file):
    """Test checker for query inputs (from query_input_file).

    Write the output to query_output_file.
    For sentences, capitalize the first word and add a period at the
    end to the suggestions.

    Arguments:
    - `test_label`:
    - `query_input_file`:
    - `query_output_file`:
    """
    query_list = get_inputs(test_label, query_input_file)
    checker = spell_checker.SpellChecker()

    if sys.argv[1] == 'dummy-test':
        checker.get_posterior_fn = dummy_posterior_fn
    
    checker.run_spell_check(query_list)
    suggestion_dict = checker.get_suggestion_dict()

    # print 'suggestion_dict', suggestion_dict
    
    # TODO: Remove this
    save_memoize_table()

    # Note: The query_list must be sent and not suggestion_dict.keys()
    # cos the original order of queries must be maintained
    write_outputs(test_label, query_list, suggestion_dict, 
                  query_output_file)
    EF1: {5}\tNum queries: {2}\n'.format(
            str(datetime.now()), test_label, len(query_list), *stats)
    print 'stats_str', stats_str
    f.write(stats_str)
    f.close()

if __name__ == '__main__':
    commandline_args_str = 'Format: ' + sys.argv[0] + ' arg\n' + 'arg = run-test: run all tests and write to results file.\n' + 'arg = calc-stats: calculate stats from results in file.\n'

    # test_labels = ['phrases']
    test_labels = ['words', 'phrases', 'sentences']
    if len (sys.argv) != 2:
        print 'commandline_args_str', commandline_args_str
        exit (0)
    elif sys.argv[1] in ['run-test', 'dummy-test']:
        for test_label in test_labels:
            test_queries(test_label, 
                         '../data/' + test_label +  '.input', 
                         '../data/' + test_label + '.output')
        save_memoize_table()
    elif sys.argv[1] == 'calc-stats':
        for test_label in test_labels:
            calc_stats(test_label, 
                       '../data/' + test_label + '.output', 
                       '../data/' + test_label + '.tsv', 
                       '../data/' + test_label + '.stats')
        save_memoize_table()
    else:
        print 'commandline_args_str', commandline_args_str
        exit (0)