Show More
@@ -41,7 +41,7 b' somewhere in your configuration files or ipython command line.' | |||
|
41 | 41 | # the file COPYING, distributed as part of this software. |
|
42 | 42 | #***************************************************************************** |
|
43 | 43 | |
|
44 |
import os |
|
|
44 | import os | |
|
45 | 45 | import subprocess |
|
46 | 46 | import sys |
|
47 | 47 | |
@@ -146,7 +146,8 b' class CommandChainDispatcher:' | |||
|
146 | 146 | |
|
147 | 147 | def add(self, func, priority=0): |
|
148 | 148 | """ Add a func to the cmd chain with given priority """ |
|
149 |
|
|
|
149 | self.chain.append((priority, func)) | |
|
150 | self.chain.sort(key=lambda x: x[0]) | |
|
150 | 151 | |
|
151 | 152 | def __iter__(self): |
|
152 | 153 | """ Return all objects in chain. |
@@ -73,3 +73,9 b' def test_command_chain_dispatcher_fofo():' | |||
|
73 | 73 | nt.assert_true(okay1.called) |
|
74 | 74 | nt.assert_false(fail2.called) |
|
75 | 75 | nt.assert_false(okay2.called) |
|
76 | ||
|
77 | def test_command_chain_dispatcher_eq_priority(): | |
|
78 | okay1 = Okay(u'okay1') | |
|
79 | okay2 = Okay(u'okay2') | |
|
80 | dp = CommandChainDispatcher([(1, okay1)]) | |
|
81 | dp.add(okay2, 1) |
General Comments 0
You need to be logged in to leave comments.
Login now