Skip to content

Commit 1dd4581

Browse files
committed
Implement test of function calls
1 parent 5c6480b commit 1dd4581

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

test/test_player.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,29 @@ def assertSuccessfulCleanup(self):
4141
def test_play_virtual(self):
4242
sys.argv = self.baseargs + [self.logfile]
4343
can.player.main()
44-
self.assertEqual(self.mock_virtual_bus.send.call_count, 2)
44+
msg1 = can.Message(
45+
timestamp=2.501,
46+
arbitration_id=0xC8,
47+
is_extended_id=False,
48+
is_fd=False,
49+
is_rx=False,
50+
channel=1,
51+
dlc=8,
52+
data=[0x9, 0x8, 0x7, 0x6, 0x5, 0x4, 0x3, 0x2],
53+
)
54+
msg2 = can.Message(
55+
timestamp=17.876708,
56+
arbitration_id=0x6F9,
57+
is_extended_id=False,
58+
is_fd=False,
59+
is_rx=True,
60+
channel=0,
61+
dlc=8,
62+
data=[0x5, 0xC, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0],
63+
)
4564
self.assertEqual(self.MockSleep.call_count, 2)
65+
self.assertTrue(msg1.equals(self.mock_virtual_bus.send.mock_calls[0].args[0]))
66+
self.assertTrue(msg2.equals(self.mock_virtual_bus.send.mock_calls[1].args[0]))
4667
self.assertSuccessfulCleanup()
4768

4869
def test_play_virtual_verbose(self):

0 commit comments

Comments
 (0)