Skip to content

Commit 1939163

Browse files
committed
Add a test for allowing reload for non-stream outputs
1 parent 8efe1c7 commit 1939163

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

tests/test_ynotebook.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,33 @@ def __repr__(self):
142142
[
143143
# modifications of single attributes
144144
([["source", "'b'"]], [ExpectedEvent(TextEvent)]),
145+
([["execution_count", 2]], [ExpectedEvent(MapEvent)]),
146+
([["metadata", {"tags": []}]], [ExpectedEvent(MapEvent)]),
147+
([["new_key", "test"]], [ExpectedEvent(MapEvent)]),
148+
# outputs can be cleared using granular logic
145149
([["outputs", []]], [ExpectedEvent(ArrayEvent, path=[0, "outputs"])]),
150+
# stream outputs require a hard cell reload, which is why we expect top-level array change
146151
(
147152
[["outputs", [{"name": "stdout", "output_type": "stream", "text": "b\n"}]]],
148153
[ExpectedEvent(ArrayEvent, path=[])],
149154
),
150-
([["execution_count", 2]], [ExpectedEvent(MapEvent)]),
151-
([["metadata", {"tags": []}]], [ExpectedEvent(MapEvent)]),
152-
([["new_key", "test"]], [ExpectedEvent(MapEvent)]),
155+
# other output types can be changed granularly
156+
(
157+
[
158+
[
159+
"outputs",
160+
[
161+
{
162+
"data": {"text/plain": ["1"]},
163+
"execution_count": 1,
164+
"metadata": {},
165+
"output_type": "execute_result",
166+
}
167+
],
168+
]
169+
],
170+
[ExpectedEvent(ArrayEvent, path=[0, "outputs"])],
171+
),
153172
# multi-attribute modifications
154173
(
155174
[["source", "10"], ["execution_count", 10]],

0 commit comments

Comments
 (0)