1111from parameterized import parameterized
1212
1313import can
14- from can . bus import BusState
14+ from can import BusState , CANProtocol
1515from can .exceptions import CanInitializationError
1616from can .interfaces .pcan import PcanBus , PcanError
1717from can .interfaces .pcan .basic import *
@@ -53,7 +53,7 @@ def test_bus_creation(self) -> None:
5353 self .bus = can .Bus (interface = "pcan" )
5454
5555 self .assertIsInstance (self .bus , PcanBus )
56- self .assertFalse (self .bus .is_fd )
56+ self .assertEqual (self .bus .protocol , CANProtocol . CAN_20 )
5757
5858 self .MockPCANBasic .assert_called_once ()
5959 self .mock_pcan .Initialize .assert_called_once ()
@@ -81,7 +81,7 @@ def test_bus_creation_fd(self, clock_param: str, clock_val: int) -> None:
8181 )
8282
8383 self .assertIsInstance (self .bus , PcanBus )
84- self .assertTrue (self .bus .is_fd )
84+ self .assertEqual (self .bus .protocol , CANProtocol . CAN_FD )
8585
8686 self .MockPCANBasic .assert_called_once ()
8787 self .mock_pcan .Initialize .assert_not_called ()
@@ -459,7 +459,7 @@ def test_constructor_bit_timing(self):
459459
460460 bitrate_arg = self .mock_pcan .Initialize .call_args [0 ][1 ]
461461 self .assertEqual (bitrate_arg .value , 0x472F )
462- self .assertFalse (bus .is_fd )
462+ self .assertEqual (bus .protocol , CANProtocol . CAN_20 )
463463
464464 def test_constructor_bit_timing_fd (self ):
465465 timing = can .BitTimingFd (
@@ -474,7 +474,7 @@ def test_constructor_bit_timing_fd(self):
474474 data_sjw = 1 ,
475475 )
476476 bus = can .Bus (interface = "pcan" , channel = "PCAN_USBBUS1" , timing = timing )
477- self .assertTrue (bus .is_fd )
477+ self .assertEqual (bus .protocol , CANProtocol . CAN_FD )
478478
479479 bitrate_arg = self .mock_pcan .InitializeFD .call_args [0 ][- 1 ]
480480
0 commit comments