Skip to content

Commit

Permalink
test: fix test that contained a newline, and now shouldn't (jupyter-w…
Browse files Browse the repository at this point in the history
…idgets#3720)

could be a change in IPython/ipykernel
  • Loading branch information
martinRenou authored Mar 21, 2023
1 parent 7325e59 commit 462ecd3
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions python/ipywidgets/ipywidgets/widgets/tests/test_widget_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ def test_append_display_data():

# Now try appending an Image.
image_data = b"foobar"
image_data_b64 = 'Zm9vYmFy\n'

widget.append_display_data(Image(image_data, width=123, height=456))
expected += (
# Old ipykernel/IPython
expected1 = expected + (
{
'output_type': 'display_data',
'data': {
'image/png': image_data_b64,
'image/png': 'Zm9vYmFy\n',
'text/plain': '<IPython.core.display.Image object>'
},
'metadata': {
Expand All @@ -220,4 +220,20 @@ def test_append_display_data():
}
},
)
assert widget.outputs == expected, repr(widget.outputs)
# Latest ipykernel/IPython
expected2 = expected + (
{
'output_type': 'display_data',
'data': {
'image/png': 'Zm9vYmFy',
'text/plain': '<IPython.core.display.Image object>'
},
'metadata': {
'image/png': {
'width': 123,
'height': 456
}
}
},
)
assert widget.outputs == expected1 or widget.outputs == expected2

0 comments on commit 462ecd3

Please sign in to comment.