Evaluate_test_cases_function

I just want to know that what is the code written inside evaluate_test_cases function :slightly_smiling_face: . Its very useful function for evaluating test cases…

From jovian source:

def evaluate_test_cases(function, test_cases, error_only=False):
    results = []
    for i, test_case in enumerate(test_cases):
        if not error_only:
            print("\n\033[1mTEST CASE #{}\033[0m".format(i))
        result = evaluate_test_case(function, test_case, display=False)
        results.append(result)
        if error_only and not result[1]:
            print("\n\033[1mTEST CASE #{}\033[0m".format(i))
        if not error_only or not result[1]:
            _show_test_case(test_case)
            _show_result(result)

    total = len(results)
    num_passed = sum([r[1] for r in results])
    print("\n\033[1mSUMMARY\033[0m")
    print("\nTOTAL: {}, \033[92mPASSED\033[0m: {}, \033[91mFAILED\033[0m: {}".format(
        total, num_passed, total - num_passed))
    return results
1 Like

Thanks you so much @Sebgolos Sebastian . :))

why my test cases are repeating in evaluate_test_case functon …like my test case 3 is appearing twice by replacing the 4 test cases??

Where do they repeat?
What do you mean by replacing?

Could you show the output?

It is showing something like this

You probably add test3 variable two times to the tests list.

1 Like

yes you are correct !! It was my fault I should have check my code once … Thank you :))