Permalink
Browse files

TST: Add more unit tests for in-process kernel manager.

  • Loading branch information...
1 parent fc75ceb commit 6632e6c3384aa38c7766338e4b010bccd39e7b28 @epatters epatters committed Sep 26, 2012
Showing with 25 additions and 0 deletions.
  1. +25 −0 IPython/inprocess/tests/test_kernelmanager.py
@@ -60,6 +60,18 @@ def test_execute(self):
km.shell_channel.execute('foo = 1')
self.assertEquals(km.kernel.shell.user_ns['foo'], 1)
+ def test_complete(self):
+ """ Does requesting completion from an in-process kernel work?
+ """
+ km = BlockingInProcessKernelManager()
+ km.start_kernel()
+ km.kernel.shell.push({'my_bar': 0, 'my_baz': 1})
+ km.shell_channel.complete('my_ba', 'my_ba', 5)
+ msg = km.shell_channel.get_msg()
+ self.assertEquals(msg['header']['msg_type'], 'complete_reply')
+ self.assertEquals(sorted(msg['content']['matches']),
+ ['my_bar', 'my_baz'])
+
def test_object_info(self):
""" Does requesting object information from an in-process kernel work?
"""
@@ -72,6 +84,19 @@ def test_object_info(self):
self.assertEquals(msg['content']['name'], 'foo')
self.assertEquals(msg['content']['type_name'], 'int')
+ def test_history(self):
+ """ Does requesting history from an in-process kernel work?
+ """
+ km = BlockingInProcessKernelManager()
+ km.start_kernel()
+ km.shell_channel.execute('%who')
+ km.shell_channel.history(hist_access_type='tail', n=1)
+ msg = km.shell_channel.get_msgs()[-1]
+ self.assertEquals(msg['header']['msg_type'], 'history_reply')
+ history = msg['content']['history']
+ self.assertEquals(len(history), 1)
+ self.assertEquals(history[0][2], '%who')
+
if __name__ == '__main__':
unittest.main()

0 comments on commit 6632e6c

Please sign in to comment.