diff --git a/scripts/py_matter_yamltests/matter_yamltests/pics_checker.py b/scripts/py_matter_yamltests/matter_yamltests/pics_checker.py index 580c83dfd696c6..5c1fca1101240d 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/pics_checker.py +++ b/scripts/py_matter_yamltests/matter_yamltests/pics_checker.py @@ -39,10 +39,11 @@ class InvalidPICSParsingError(Exception): class PICSChecker(): """Class to compute a PICS expression""" - __pics: None - __expression_index: 0 def __init__(self, pics_file: str): + self.__pics = {} + self.__expression_index = 0 + if pics_file is not None: self.__pics = self.__parse(pics_file) diff --git a/scripts/py_matter_yamltests/test_pics_checker.py b/scripts/py_matter_yamltests/test_pics_checker.py index df3364c0d21c4b..39f2dcd10b6806 100644 --- a/scripts/py_matter_yamltests/test_pics_checker.py +++ b/scripts/py_matter_yamltests/test_pics_checker.py @@ -67,6 +67,11 @@ class TestPICSChecker(unittest.TestCase): + def test_no_file(self): + pics_checker = PICSChecker(None) + self.assertIsInstance(pics_checker, PICSChecker) + self.assertFalse(pics_checker.check('A.A')) + @patch('builtins.open', mock_open(read_data=empty_config)) def test_empty_config(self): pics_checker = PICSChecker('')