mk_assert.print_helper

 1import colorama
 2
 3colorama.just_fix_windows_console()
 4
 5RESET = colorama.Style.RESET_ALL
 6
 7
 8def print_assert(msg: str, passed: bool) -> None:
 9    prefix = f"Check: {msg} " if msg else "Check: "
10    word = "SUCCESS" if passed else "FAILURE"
11    color = colorama.Fore.GREEN if passed else colorama.Fore.RED
12    print(f"{prefix}[{color}{word}{RESET}]")
13
14
15def print_test_summary(test_name: str, passed: int, failed: int) -> None:
16    total = passed + failed
17    color = colorama.Fore.GREEN if failed == 0 else colorama.Fore.RED
18    print(
19        f"{colorama.Fore.BLUE}Test '{test_name}' finished:{RESET} ",
20        end="",
21    )
22    if failed == 0:
23        print(f"{color}all passed{RESET} - {color}{passed}{RESET}/{total}")
24    else:
25        print(f"{color}{failed} failed{RESET} - {color}{passed}{RESET}/{total}")
26
27
28def print_test_start(test_name: str) -> None:
29    print(f"{colorama.Fore.BLUE}Starting test '{test_name}'...{RESET}")
RESET = '\x1b[0m'