Skip to content

Commit ff483eb

Browse files
committed
新增信号测试
1 parent 6e4c71a commit ff483eb

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

test/test_blinker.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
"""
5+
@author: zhanghe
6+
@software: PyCharm
7+
@file: test_blinker.py
8+
@time: 2017/6/6 下午10:48
9+
"""
10+
11+
12+
from blinker import signal
13+
14+
started = signal('round-started')
15+
16+
17+
def each(round):
18+
print "Round %s!" % round
19+
20+
21+
started.connect(each)
22+
23+
24+
def round_two(round):
25+
print "This is round two."
26+
27+
28+
started.connect(round_two, sender=2)
29+
30+
31+
for r in range(1, 4):
32+
started.send(r)
33+
34+
35+
# https://pypi.python.org/pypi/blinker
36+
# http://pythonhosted.org/blinker/
37+
# https://github.com/jek/blinker

0 commit comments

Comments
 (0)