Skip to content

Commit

Permalink
further fix for #413
Browse files Browse the repository at this point in the history
  • Loading branch information
ebroecker committed Oct 28, 2019
1 parent 34ff0ea commit 32c8833
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/canmatrix/formats/dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
if re.match('.*" *;\Z',l.decode(dbc_import_encoding).strip()) is not None:
follow_up = _FollowUps.NOTHING
if signal is not None:
signal.add_comment(comment[0:-2])
signal.add_comment(comment[:-1].strip()[:-1])
continue
elif follow_up == _FollowUps.FRAME_COMMENT:
try:
Expand All @@ -514,7 +514,7 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
if re.match('.*" *;\Z',l.decode(dbc_import_encoding).strip()) is not None:
follow_up = _FollowUps.NOTHING
if frame is not None:
frame.add_comment(comment[0:-2])
frame.add_comment(comment[:-1].strip()[:-1])
continue
elif follow_up == _FollowUps.BOARD_UNIT_COMMENT:
try:
Expand All @@ -525,7 +525,7 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
if re.match('.*" *;\Z',l.decode(dbc_import_encoding).strip()) is not None:
follow_up = _FollowUps.NOTHING
if board_unit is not None:
board_unit.add_comment(comment[0:-2])
board_unit.add_comment(comment[:-1].strip()[:-1])
continue
decoded = l.decode(dbc_import_encoding).strip()
if decoded.startswith("BO_ "):
Expand Down
3 changes: 2 additions & 1 deletion src/canmatrix/tests/test_dbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def test_parse_multi_line_comment():
** ignore for now, more definition to be provided in Rev 14 regarding which messages to change if we have this debug flag implemented. " ;
''').encode('utf-8'))
matrix = canmatrix.formats.dbc.load(dbc)
assert matrix.frames[0].signals[0].comment == 'Debug request message from the ECU to the BMS.\n** ignore for now, more definition to be provided in Rev 14 regarding which messages to change if we have this debug flag implemented. "'
assert matrix.frames[0].signals[0].comment == 'Debug request message from the ECU to the BMS.\n** ignore for now, more definition to be provided in Rev 14 regarding which messages to change if we have this debug flag implemented. '


def test_long_frame_name_imports():
long_frame_name = u'A_VERY_LONG_FRAME_NAME_WHICH_SHOULD_BE_SPLIT_SOMEHOW'
Expand Down

0 comments on commit 32c8833

Please sign in to comment.