test: cover Jupyter MIME output paths
This commit is contained in:
@@ -67,6 +67,27 @@ class AsyncTransportTests(unittest.IsolatedAsyncioTestCase):
|
||||
)
|
||||
self.assertEqual(error.content["ename"], "ValueError")
|
||||
|
||||
async def test_transport_preserves_matplotlib_mime_output(self):
|
||||
transport = JupyterTransport()
|
||||
await transport.start()
|
||||
try:
|
||||
call_id = await transport.execute(
|
||||
"import matplotlib.pyplot as plt\n"
|
||||
"plt.plot([1, 2, 3], [4, 5, 6])"
|
||||
)
|
||||
messages = [
|
||||
message async for message in transport.messages_for(call_id)
|
||||
]
|
||||
finally:
|
||||
await transport.shutdown()
|
||||
|
||||
display = next(
|
||||
message
|
||||
for message in messages
|
||||
if message.msg_type == "display_data"
|
||||
)
|
||||
self.assertIn("image/png", display.content["data"])
|
||||
|
||||
async def test_transport_routes_input_reply_without_parent_stdin(self):
|
||||
transport = JupyterTransport()
|
||||
await transport.start()
|
||||
|
||||
Reference in New Issue
Block a user