shared shell registry
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import asyncio
|
||||
import re
|
||||
import unittest
|
||||
|
||||
from ipython_shell.jupyter.app import JupyterApp
|
||||
@@ -48,6 +49,25 @@ class JupyterShellTests(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
|
||||
class JupyterAppTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_app_exposes_shared_shell_metadata_api(self):
|
||||
app = JupyterApp()
|
||||
try:
|
||||
created = app.create_shell()
|
||||
listed = app.list_shells()
|
||||
last = app.get_last_shell()
|
||||
selected = app.get_shell(created.name)
|
||||
info = app.info()
|
||||
finally:
|
||||
await app.shutdown()
|
||||
|
||||
self.assertEqual(len(listed), 1)
|
||||
self.assertEqual(created.shell_id, listed[0].shell_id)
|
||||
self.assertEqual(created.shell_id, last.shell_id)
|
||||
self.assertEqual(created.shell_id, selected.shell_id)
|
||||
self.assertEqual(created.execution_count, 0)
|
||||
self.assertEqual(info.shell_count, 1)
|
||||
self.assertEqual(info.last_shell, created.name)
|
||||
|
||||
async def test_named_shells_have_isolated_namespaces(self):
|
||||
app = JupyterApp()
|
||||
try:
|
||||
@@ -110,7 +130,10 @@ class JupyterAppTests(unittest.IsolatedAsyncioTestCase):
|
||||
|
||||
self.assertIsInstance(input_request, InputRequest)
|
||||
assert isinstance(input_request, InputRequest)
|
||||
self.assertTrue(input_request.call_id)
|
||||
self.assertRegex(
|
||||
input_request.call_id,
|
||||
re.compile(r"^[a-z]+-[a-z]+-[a-z]+-[0-9a-f]{4}$"),
|
||||
)
|
||||
self.assertEqual(input_request.prompt, "name? ")
|
||||
|
||||
await app.reply_to_input(input_request.call_id, "Ada")
|
||||
|
||||
Reference in New Issue
Block a user