Skip to content

Commit dd6409c

Browse files
author
Federico Bregant
committed
feat: add util port tests
1 parent 31abe6f commit dd6409c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/test_util.py

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ def test_with_new_and_alias_present(self):
5353

5454
class TestBusConfig(unittest.TestCase):
5555
base_config = dict(interface="socketcan", bitrate=500_000)
56+
port_alpha_config = dict(interface="socketcan", bitrate=500_000, port="fail123")
57+
port_to_high_config = dict(interface="socketcan", bitrate=500_000, port="999999")
58+
port_wrong_type_config = dict(interface="socketcan", bitrate=500_000, port=(1234,))
5659

5760
def test_timing_can_use_int(self):
5861
"""
@@ -64,6 +67,9 @@ def test_timing_can_use_int(self):
6467
_create_bus_config({**self.base_config, **timing_conf})
6568
except TypeError as e:
6669
self.fail(e)
70+
self.assertRaises(ValueError, _create_bus_config({**self.port_alpha_config, **timing_conf}))
71+
self.assertRaises(ValueError, _create_bus_config({**self.port_to_high_config, **timing_conf}))
72+
self.assertRaises(TypeError, _create_bus_config({**self.port_wrong_type_config, **timing_conf}))
6773

6874

6975
class TestChannel2Int(unittest.TestCase):

0 commit comments

Comments
 (0)