##// END OF EJS Templates
Rewrite VersionReply spec using List and Unicode
Takafumi Arakaki -
Show More
@@ -16,13 +16,12 b' from Queue import Empty'
16 import nose.tools as nt
16 import nose.tools as nt
17
17
18 from ..blockingkernelmanager import BlockingKernelManager
18 from ..blockingkernelmanager import BlockingKernelManager
19 from .. import ipkernel
20
19
21
20
22 from IPython.testing import decorators as dec
21 from IPython.testing import decorators as dec
23 from IPython.utils import io
22 from IPython.utils import io
24 from IPython.utils.traitlets import (
23 from IPython.utils.traitlets import (
25 HasTraits, TraitError, Bool, Unicode, Dict, Integer, List, Enum,
24 HasTraits, TraitError, Bool, Unicode, Dict, Integer, List, Enum, Any,
26 )
25 )
27
26
28 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
@@ -196,11 +195,23 b' class CompleteReply(Reference):'
196 matches = List(Unicode)
195 matches = List(Unicode)
197
196
198
197
198 def Version(num, trait=Integer):
199 return List(trait, default_value=[0] * num, minlen=num, maxlen=num)
200
201
199 class VersionReply(Reference):
202 class VersionReply(Reference):
200 protocol_version = Enum((ipkernel.protocol_version,))
203
201 ipython_version = Enum((ipkernel.ipython_version,))
204 protocol_version = Version(2)
202 language_version = Enum((ipkernel.language_version,))
205 ipython_version = Version(4, Any)
203 language = Enum(("python",))
206 language_version = Version(3)
207 language = Unicode()
208
209 def _ipython_version_changed(self, name, old, new):
210 for v in new:
211 nt.assert_true(
212 isinstance(v, int) or isinstance(v, basestring),
213 'expected int or string as version component, got {!r}'
214 .format(v))
204
215
205
216
206 # IOPub messages
217 # IOPub messages
General Comments 0
You need to be logged in to leave comments. Login now