##// END OF EJS Templates
TST: Add more unit tests for in-process kernel manager.
epatters -
Show More
@@ -60,6 +60,18 b' class InProcessKernelManagerTestCase(unittest.TestCase):'
60 km.shell_channel.execute('foo = 1')
60 km.shell_channel.execute('foo = 1')
61 self.assertEquals(km.kernel.shell.user_ns['foo'], 1)
61 self.assertEquals(km.kernel.shell.user_ns['foo'], 1)
62
62
63 def test_complete(self):
64 """ Does requesting completion from an in-process kernel work?
65 """
66 km = BlockingInProcessKernelManager()
67 km.start_kernel()
68 km.kernel.shell.push({'my_bar': 0, 'my_baz': 1})
69 km.shell_channel.complete('my_ba', 'my_ba', 5)
70 msg = km.shell_channel.get_msg()
71 self.assertEquals(msg['header']['msg_type'], 'complete_reply')
72 self.assertEquals(sorted(msg['content']['matches']),
73 ['my_bar', 'my_baz'])
74
63 def test_object_info(self):
75 def test_object_info(self):
64 """ Does requesting object information from an in-process kernel work?
76 """ Does requesting object information from an in-process kernel work?
65 """
77 """
@@ -72,6 +84,19 b' class InProcessKernelManagerTestCase(unittest.TestCase):'
72 self.assertEquals(msg['content']['name'], 'foo')
84 self.assertEquals(msg['content']['name'], 'foo')
73 self.assertEquals(msg['content']['type_name'], 'int')
85 self.assertEquals(msg['content']['type_name'], 'int')
74
86
87 def test_history(self):
88 """ Does requesting history from an in-process kernel work?
89 """
90 km = BlockingInProcessKernelManager()
91 km.start_kernel()
92 km.shell_channel.execute('%who')
93 km.shell_channel.history(hist_access_type='tail', n=1)
94 msg = km.shell_channel.get_msgs()[-1]
95 self.assertEquals(msg['header']['msg_type'], 'history_reply')
96 history = msg['content']['history']
97 self.assertEquals(len(history), 1)
98 self.assertEquals(history[0][2], '%who')
99
75
100
76 if __name__ == '__main__':
101 if __name__ == '__main__':
77 unittest.main()
102 unittest.main()
General Comments 0
You need to be logged in to leave comments. Login now