예제 #1
0
 def test_complete(self):
     """ Does requesting completion from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.push({"my_bar": 0, "my_baz": 1})
     kc.complete("my_ba", "my_ba", 5)
     msg = kc.get_shell_msg()
     self.assertEqual(msg["header"]["msg_type"], "complete_reply")
     self.assertEqual(sorted(msg["content"]["matches"]), ["my_bar", "my_baz"])
예제 #2
0
 def test_object_info(self):
     """ Does requesting object information from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.user_ns['foo'] = 1
     kc.object_info('foo')
     msg = kc.get_shell_msg()
     self.assertEquals(msg['header']['msg_type'], 'object_info_reply')
     self.assertEquals(msg['content']['name'], 'foo')
     self.assertEquals(msg['content']['type_name'], 'int')
예제 #3
0
 def test_complete(self):
     """ Does requesting completion from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.push({'my_bar': 0, 'my_baz': 1})
     kc.complete('my_ba', 'my_ba', 5)
     msg = kc.get_shell_msg()
     self.assertEqual(msg['header']['msg_type'], 'complete_reply')
     self.assertEqual(sorted(msg['content']['matches']),
                       ['my_bar', 'my_baz'])
예제 #4
0
 def test_object_info(self):
     """ Does requesting object information from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.user_ns['foo'] = 1
     kc.object_info('foo')
     msg = kc.get_shell_msg()
     self.assertEquals(msg['header']['msg_type'], 'object_info_reply')
     self.assertEquals(msg['content']['name'], 'foo')
     self.assertEquals(msg['content']['type_name'], 'int')
예제 #5
0
 def test_complete(self):
     """ Does requesting completion from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.push({'my_bar': 0, 'my_baz': 1})
     kc.complete('my_ba', 'my_ba', 5)
     msg = kc.get_shell_msg()
     self.assertEqual(msg['header']['msg_type'], 'complete_reply')
     self.assertEqual(sorted(msg['content']['matches']),
                      ['my_bar', 'my_baz'])
예제 #6
0
 def test_object_info(self):
     """ Does requesting object information from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.user_ns["foo"] = 1
     kc.object_info("foo")
     msg = kc.get_shell_msg()
     self.assertEquals(msg["header"]["msg_type"], "object_info_reply")
     self.assertEquals(msg["content"]["name"], "foo")
     self.assertEquals(msg["content"]["type_name"], "int")
예제 #7
0
 def test_inspect(self):
     """ Does requesting object information from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.user_ns['foo'] = 1
     kc.inspect('foo')
     msg = kc.get_shell_msg()
     self.assertEqual(msg['header']['msg_type'], 'inspect_reply')
     content = msg['content']
     assert content['found']
     text = content['data']['text/plain']
     self.assertIn('int', text)
예제 #8
0
 def test_inspect(self):
     """ Does requesting object information from an in-process kernel work?
     """
     km = InProcessKernelManager()
     km.start_kernel()
     kc = BlockingInProcessKernelClient(kernel=km.kernel)
     kc.start_channels()
     km.kernel.shell.user_ns['foo'] = 1
     kc.inspect('foo')
     msg = kc.get_shell_msg()
     self.assertEqual(msg['header']['msg_type'], 'inspect_reply')
     content = msg['content']
     assert content['found']
     text = content['data']['text/plain']
     self.assertIn('int', text)