-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
39 lines (26 loc) · 939 Bytes
/
test.py
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
30
31
32
33
34
35
36
37
38
39
import unittest
import asyncEvento
import asyncio
class TestSynchronousEmit(unittest.TestCase):
def test(self):
emitter = asyncEvento.EventoEmitter()
def hello():
print("\nHello World (Synchronous)\n")
emitter.emit("stop", True)
emitter.on("hello", hello)
emitter.once("stop", asyncEvento.EventoEmitter.stop)
emitter.emit("hello")
emitter.listen()
class TestAsynchronousEmit(unittest.TestCase):
def test(self):
emitter = asyncEvento.EventoEmitter()
async def hello():
await asyncio.sleep(1)
print("\nHello World (Asynchronous)\n")
emitter.emit("stop", True)
emitter.on("hello", hello)
emitter.once("stop", asyncEvento.EventoEmitter.stop)
emitter.emit("hello", True)
emitter.listen()
if __name__ == "__main__":
unittest.main()