Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion jupyter_ydoc/ynotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,12 @@ def create_ycell(self, value: Dict[str, Any]) -> Map:
outputs = cell.get("outputs", [])
for idx, output in enumerate(outputs):
if output.get("output_type") == "stream":
output["text"] = Array(output.get("text", []))
text = output.get("text", "")
if isinstance(text, str):
ytext = Text(text)
else:
ytext = Text("".join(text))
output["text"] = ytext
outputs[idx] = Map(output)
cell["outputs"] = Array(outputs)
cell["execution_state"] = "idle"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pycrdt_yjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ async def test_ypy_yjs_1(yws_server, yjs_client):
ydoc, Websocket(websocket, room_name)
):
output_text = ynotebook.ycells[0]["outputs"][0]["text"]
assert output_text.to_py() == ["Hello,"]
assert output_text.to_py() == "Hello,"
event = Event()

def callback(_event):
Expand All @@ -101,7 +101,7 @@ def callback(_event):
with move_on_after(10):
await event.wait()

assert output_text.to_py() == ["Hello,", " World!"]
assert output_text.to_py() == "Hello,", " World!"


def test_plotly_renderer():
Expand Down
Loading