Skip to content

Commit 5a43bb8

Browse files
committed
Add test for wrong api version
1 parent 1dcc736 commit 5a43bb8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/test_pcan.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import can
1414
from can.bus import BusState
15+
from can.exceptions import CanInitializationError
1516
from can.interfaces.pcan.basic import *
1617
from can.interfaces.pcan import PcanBus, PcanError
1718

@@ -65,6 +66,11 @@ def test_bus_creation_fd(self) -> None:
6566
self.mock_pcan.Initialize.assert_not_called()
6667
self.mock_pcan.InitializeFD.assert_called_once()
6768

69+
def test_api_version_error(self) -> None:
70+
self.PCAN_API_VERSION_SIM = "1.0"
71+
with self.assertRaises(CanInitializationError):
72+
self.bus = can.Bus(bustype="pcan")
73+
6874
@parameterized.expand(
6975
[
7076
("no_error", PCAN_ERROR_OK, PCAN_ERROR_OK, "some ok text 1"),

0 commit comments

Comments
 (0)