code: def test_append_display_data():
      widget = widget_output.Output()
  
      # Try appending a Markdown object.
      widget.append_display_data(Markdown("# snakes!"))
      expected = (
          {
              "output_type": "display_data",
              "data": {
                  "text/plain": "<IPython.core.display.Markdown object>",
                  "text/markdown": "# snakes!",
              },
              "metadata": {},
          },
      )
      assert widget.outputs == expected, repr(widget.outputs)
  
      # Now try appending an Image.
      image_data = b"foobar"
  
      widget.append_display_data(
          Image(image_data, width=123, height=456)
      )
      # Old ipykernel/IPython
      expected1 = expected + (
          {
              "output_type": "display_data",
              "data": {
                  "image/png": "Zm9vYmFy\n",
                  "text/plain": "<IPython.core.display.Image object>",
              },
              "metadata": {"image/png": {"width": 123, "height": 456}},
          },
      )
      # 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
  
file_path: catboost/contrib/python/ipywidgets/py3/ipywidgets/widgets/tests/test_widget_output.py
imports: import sys
  from unittest import TestCase
  from contextlib import contextmanager
  from IPython.display import Markdown, Image
  from ipywidgets import widget_output
label_desc: Use image node_id 4 for calling a global function with example usage: test_append_display_data() without return types