Skip to content

Commit

Permalink
'text' to "text"
Browse files Browse the repository at this point in the history
  • Loading branch information
Novecento99 committed Jul 17, 2024
1 parent f45d60e commit bb4b2e7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions snap7/util/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit bb4b2e7

Please sign in to comment.