Convert BusState to enum when read with configparser by Gregox273 · Pull Request #1957 · hardbyte/python-can
|
|
||
| self.check_api_version() | ||
|
|
||
| if not isinstance(state, BusState): |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is the wrong place for this. The config value should be converted in can.util._create_bus_config().
Greg Brooks added 5 commits
July 22, 2025 10:16| ) | ||
| state = can_cfg["state"] | ||
| assert isinstance(state, can.BusState) | ||
| assert state == can.BusState.PASSIVE |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: enums should be compared by identity (state is can.BusState.PASSIVE)
| ) | ||
| state = can_cfg["state"] | ||
| assert isinstance(state, can.BusState) | ||
| assert state == expected_state |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters