From 28a146d90892cc4abd43e4f8a1eb269316a9f39b 2011-07-14 22:21:15 From: Brian E. Granger Date: 2011-07-14 22:21:15 Subject: [PATCH] Adding tests for zmq.session. --- diff --git a/IPython/zmq/session.py b/IPython/zmq/session.py index 75572c8..b22d243 100644 --- a/IPython/zmq/session.py +++ b/IPython/zmq/session.py @@ -436,7 +436,7 @@ class Session(Configurable): return to_send - def send(self, stream, msg_or_type, content=None, parent=None, ident=None + def send(self, stream, msg_or_type, content=None, parent=None, ident=None, buffers=None, subheader=None, track=False, header=None): """Build and send a message via stream or socket. diff --git a/IPython/zmq/tests/test_session.py b/IPython/zmq/tests/test_session.py index 86badca..9d277db 100644 --- a/IPython/zmq/tests/test_session.py +++ b/IPython/zmq/tests/test_session.py @@ -31,14 +31,24 @@ class TestSession(SessionTestCase): def test_msg(self): """message format""" msg = self.session.msg('execute') - thekeys = set('header msg_id parent_header msg_type content'.split()) + thekeys = set('header parent_header content'.split()) s = set(msg.keys()) self.assertEquals(s, thekeys) self.assertTrue(isinstance(msg['content'],dict)) self.assertTrue(isinstance(msg['header'],dict)) self.assertTrue(isinstance(msg['parent_header'],dict)) self.assertEquals(msg['header']['msg_type'], 'execute') - + + def test_serialize(self): + msg = self.session.msg('execute') + msg_list = self.session.serialize(msg, ident=b'foo') + ident, msg_list = self.session.feed_identities(msg_list) + new_msg = self.session.unserialize(msg_list) + self.assertEquals(ident[0], b'foo') + self.assertEquals(new_msg['header'],msg['header']) + self.assertEquals(new_msg['content'],msg['content']) + self.assertEquals(new_msg['parent_header'],msg['parent_header']) + def test_args(self): """initialization arguments for Session""" s = self.session @@ -107,3 +117,4 @@ class TestSession(SessionTestCase): content = dict(code='whoda',stuff=object()) themsg = self.session.msg('execute',content=content) pmsg = theids +