Skip to content

Commit 462ecd3

Browse files
authored
test: fix test that contained a newline, and now shouldn't (#3720)
could be a change in IPython/ipykernel
1 parent 7325e59 commit 462ecd3

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

python/ipywidgets/ipywidgets/widgets/tests/test_widget_output.py

+20-4
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,14 @@ def test_append_display_data():
202202

203203
# Now try appending an Image.
204204
image_data = b"foobar"
205-
image_data_b64 = 'Zm9vYmFy\n'
206205

207206
widget.append_display_data(Image(image_data, width=123, height=456))
208-
expected += (
207+
# Old ipykernel/IPython
208+
expected1 = expected + (
209209
{
210210
'output_type': 'display_data',
211211
'data': {
212-
'image/png': image_data_b64,
212+
'image/png': 'Zm9vYmFy\n',
213213
'text/plain': '<IPython.core.display.Image object>'
214214
},
215215
'metadata': {
@@ -220,4 +220,20 @@ def test_append_display_data():
220220
}
221221
},
222222
)
223-
assert widget.outputs == expected, repr(widget.outputs)
223+
# Latest ipykernel/IPython
224+
expected2 = expected + (
225+
{
226+
'output_type': 'display_data',
227+
'data': {
228+
'image/png': 'Zm9vYmFy',
229+
'text/plain': '<IPython.core.display.Image object>'
230+
},
231+
'metadata': {
232+
'image/png': {
233+
'width': 123,
234+
'height': 456
235+
}
236+
}
237+
},
238+
)
239+
assert widget.outputs == expected1 or widget.outputs == expected2

0 commit comments

Comments
 (0)