From: Alexander Popov Date: Sat, 9 Mar 2024 21:41:49 +0000 (+0300) Subject: Fix the fresh set_state() bug found by unittest X-Git-Tag: v0.6.10~100 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=0adb72a5972d39a1797630cb262a8494b9ba863b;p=kconfig-hardened-check.git Fix the fresh set_state() bug found by unittest This function should write 'self.state' anyway. Refers to #88, #89, #97 --- diff --git a/kernel_hardening_checker/engine.py b/kernel_hardening_checker/engine.py index 8ba34ef..960f4f4 100644 --- a/kernel_hardening_checker/engine.py +++ b/kernel_hardening_checker/engine.py @@ -62,10 +62,9 @@ class OptCheck: return None def set_state(self, data): - if data: - assert(isinstance(data, str)), \ + assert(data is None or isinstance(data, str)), \ f'invalid state "{data}" for "{self.name}" check' - self.state = data + self.state = data def check(self): # handle the 'is present' check