Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[matter_yamltests] Ensure that the PICSChecker code does not throw if… #24614

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scripts/py_matter_yamltests/matter_yamltests/pics_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions scripts/py_matter_yamltests/test_pics_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
Expand Down