-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathtest_ticks.py
More file actions
29 lines (24 loc) · 838 Bytes
/
test_ticks.py
File metadata and controls
29 lines (24 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from typing import List
from i3ipc.events import TickEvent
from ipctest import IpcTest
class TestTicks(IpcTest):
events: List[TickEvent] = []
def on_tick(self, i3, e: TickEvent):
self.events.append(e)
if len(self.events) == 3:
i3.main_quit()
def test_tick_event(self, i3):
i3.on('tick', self.on_tick)
i3._event_socket_setup()
i3.send_tick()
i3.send_tick('hello world')
while not i3._event_socket_poll():
pass
i3._event_socket_teardown()
assert len(self.events) == 3
assert self.events[0].first
assert self.events[0].payload == ''
assert not self.events[1].first
assert self.events[1].payload == ''
assert not self.events[2].first
assert self.events[2].payload == 'hello world'