def run_benchmark(search_string, all_keywords):
    search_string_lower = search_string.lower()
    bytes_search_string = search_string.encode('ASCII')
    bytes_search_string_lower = search_string_lower.encode('ASCII')

    import tempfile
    temp_text_file = tempfile.NamedTemporaryFile()
    temp_text_file.write(bytes_search_string)
    temp_text_file.flush()

    filename = temp_text_file.name

    for i in range(len(all_keywords),0,-1):
        for keywords in combinations(all_keywords, i):
            print((len(keywords), ' '.join(sorted(keywords))) % '##Keywords(%d): %s')
            keywords_lower = [ kw.lower() for kw in keywords ]

            results = compare_search(search_string, None, False, *keywords)
            for result in results[:2]:
                assert_equal(results, result, search_string, keywords)

            results = compare_search(search_string, None, True, *keywords)
            for result in results[:2]:
                assert_equal(results, result, search_string_lower, keywords_lower)

            keywords = [ keyword.encode('ASCII') for keyword in keywords ]

            results = compare_search(bytes_search_string, filename, False, *keywords)
            for result in results[:4]:
                assert_equal(results, result, bytes_search_string, keywords)

            if sys.version_info[0] < 3:
                keywords_lower = [ keyword.encode('ASCII') for keyword in keywords_lower ]
                # case-insensitive search in byte strings is not supported in Py3
                results = compare_search(bytes_search_string, filename, True, *keywords)
                for result in results[:4]:
                    assert_equal(results, result, bytes_search_string_lower, keywords_lower)
dataset/ETHPy150Open scoder/acora/bench.py/run_benchmark/swapped operands of `%`