Skip to content

Commit

Permalink
should fix issue #760 (#807)
Browse files Browse the repository at this point in the history
Co-authored-by: Eduard Bröcker <[email protected]>
  • Loading branch information
ebroecker and Eduard Bröcker authored Jul 12, 2024
1 parent 9278ea9 commit ef9f709
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/canmatrix/canmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,7 @@ def update_receiver(self): # type: () -> None
"""
Collect Frame receivers out of receiver given in each signal. Add them to `self.receiver` list.
"""
self.receivers = []
for sig in self.signals:
for receiver in sig.receivers:
self.add_receiver(receiver)
Expand Down
15 changes: 15 additions & 0 deletions tests/test_canmatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,21 @@ def test_canmatrix_rename_ecu_by_wrong_name(empty_matrix):
assert ecu.name == "old_name"


def test_canmatrix_rename_ecu_check_frame(empty_matrix):
ecu = canmatrix.Ecu(name="old_name")
frame = canmatrix.Frame(name="test_frame")
signal = canmatrix.Signal(name="test_signal")
signal.add_receiver("old_name")
frame.add_signal(signal)
frame.update_receiver()
assert "old_name" in frame.receivers

empty_matrix.add_ecu(ecu)
empty_matrix.add_frame(frame)
empty_matrix.rename_ecu("old_name", "new_name")
assert "old_name" not in frame.receivers
assert "new_name" in frame.receivers

def test_canmatrix_rename_ecu_by_instance(empty_matrix):
ecu = canmatrix.Ecu(name="old_name")
empty_matrix.add_ecu(ecu)
Expand Down

0 comments on commit ef9f709

Please sign in to comment.