From: Alexander Popov Date: Mon, 18 Sep 2023 05:58:44 +0000 (+0300) Subject: Refactor the assertion in colorize_result() to improve test coverage X-Git-Tag: v0.6.6~72 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=2a00311b58515e3c5f0c57e26eeabb77837930e0;p=kconfig-hardened-check.git Refactor the assertion in colorize_result() to improve test coverage --- diff --git a/kernel_hardening_checker/engine.py b/kernel_hardening_checker/engine.py index 4fdc222..64be204 100644 --- a/kernel_hardening_checker/engine.py +++ b/kernel_hardening_checker/engine.py @@ -20,10 +20,9 @@ def colorize_result(input_text): return input_text if input_text.startswith('OK'): color = GREEN_COLOR - elif input_text.startswith('FAIL:'): - color = RED_COLOR else: - assert(False), f'unexpected result "{input_text}"' + assert(input_text.startswith('FAIL:')), f'unexpected result "{input_text}"' + color = RED_COLOR return f'{color}{input_text}{COLOR_END}'