From 7c969a7e12950d5c0db3e5a35e1b9d3eba9768e1 2015-05-20 23:49:57 From: Thomas Kluyver Date: 2015-05-20 23:49:57 Subject: [PATCH] Merge pull request #8451 from minrk/adapt-object-info name isn't part of inspect_reply --- diff --git a/IPython/kernel/adapter.py b/IPython/kernel/adapter.py index c99bb9a..ac6c59a 100644 --- a/IPython/kernel/adapter.py +++ b/IPython/kernel/adapter.py @@ -292,7 +292,6 @@ class V4toV5(Adapter): content = msg['content'] new_content = msg['content'] = {'status' : 'ok'} found = new_content['found'] = content['found'] - new_content['name'] = content['oname'] new_content['data'] = data = {} new_content['metadata'] = {} if found: diff --git a/IPython/kernel/tests/test_adapter.py b/IPython/kernel/tests/test_adapter.py index fe2c886..4d0e6e7 100644 --- a/IPython/kernel/tests/test_adapter.py +++ b/IPython/kernel/tests/test_adapter.py @@ -155,7 +155,7 @@ class V4toV5TestCase(AdapterTest): def test_object_info_reply(self): msg = self.msg("object_info_reply", { - 'oname' : 'foo', + 'name' : 'foo', 'found' : True, 'status' : 'ok', 'definition' : 'foo(a=5)', @@ -165,10 +165,26 @@ class V4toV5TestCase(AdapterTest): self.assertEqual(v5['header']['msg_type'], 'inspect_reply') v4c = v4['content'] v5c = v5['content'] - self.assertEqual(sorted(v5c), [ 'data', 'found', 'metadata', 'name', 'status']) + self.assertEqual(sorted(v5c), [ 'data', 'found', 'metadata', 'status']) text = v5c['data']['text/plain'] self.assertEqual(text, '\n'.join([v4c['definition'], v4c['docstring']])) - + + def test_object_info_reply_not_found(self): + msg = self.msg("object_info_reply", { + 'name' : 'foo', + 'found' : False, + }) + v4, v5 = self.adapt(msg) + self.assertEqual(v5['header']['msg_type'], 'inspect_reply') + v4c = v4['content'] + v5c = v5['content'] + self.assertEqual(v5c, { + 'status': 'ok', + 'found': False, + 'data': {}, + 'metadata': {}, + }) + def test_kernel_info_reply(self): msg = self.msg("kernel_info_reply", { 'language': 'python',