expose shell metadata in call responses

This commit is contained in:
lda
2026-08-30 03:05:58 +07:00 Verified
parent cf0ec7b403
commit 2587b07b4a
6 changed files with 90 additions and 6 deletions
+14
View File
@@ -73,6 +73,20 @@ class AppTests(unittest.TestCase):
self.assertNotEqual(first.call_id, second.call_id)
self.assertEqual(second.result.result, 42)
def test_response_and_shell_list_expose_shell_info(self):
app = App()
with contextlib.redirect_stdout(io.StringIO()):
call = app.run_code("1 + 1", shell_name="new")
shells = app.list_shells()
self.assertEqual(len(shells), 1)
self.assertEqual(call.shell.shell_id, shells[0].shell_id)
self.assertEqual(call.shell.name, call.shell_name)
self.assertEqual(call.shell.execution_count, call.result.execution_count)
self.assertIn("execute_result", call.shell.capabilities)
if __name__ == "__main__":
unittest.main()