diff --git a/snap7/util/db.py b/snap7/util/db.py index 6996d89b..1ffc1269 100644 --- a/snap7/util/db.py +++ b/snap7/util/db.py @@ -154,9 +154,9 @@ def parse_specification(db_specification: str) -> Dict[str, Any]: if line and not line.lstrip().startswith("#"): index, *notUsed, _type = line.lstrip().split("#")[0].split() - match = re.compile(r'(\s*)(\S+)(\s*)').findall(line) + match = re.compile(r"(\s*)(\S+)(\s*)").findall(line) - var_name = ''.join([m[0] + m[1] + m[2] for m in match[1:-1]]) + var_name = "".join([m[0] + m[1] + m[2] for m in match[1:-1]]) var_name = var_name.strip() parsed_db_specification[var_name] = (index, _type) diff --git a/tests/test_util.py b/tests/test_util.py index bd41bfca..e1e08cc7 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -456,11 +456,12 @@ def test_db_creation_vars_with_whitespace(self) -> None: test_db = DB(1, test_array, test_spec, row_size=len(_bytearray), size=1, layout_offset=0, db_offset=0) - exp = test_db.export() + db_export = test_db.export() - self.assertTrue("testZeroSpaces" in exp[0].keys()) - self.assertTrue("testOne Space" in exp[0].keys()) - self.assertTrue("testTWo Spaces" in exp[0].keys()) + for i in db_export: + self.assertTrue("testZeroSpaces" in db_export[i].keys()) + self.assertTrue("testOne Space" in db_export[i].keys()) + self.assertTrue("testTWo Spaces" in db_export[i].keys()) def test_db_export(self) -> None: