code: def test_ipython_notebook_funcs():
      from dtale.views import DtaleData
  
      getter = namedtuple("get", "ok")
  
      def mock_requests_get(url, verify=True):
          return getter(True)
  
      df = pd.DataFrame([1, 2, 3])
      with ExitStack() as stack:
          mock_iframe = stack.enter_context(
              mock.patch("IPython.display.IFrame", mock.Mock())
          )
          stack.enter_context(
              mock.patch("requests.get", mock_requests_get)
          )
          stack.enter_context(
              mock.patch(
                  "dtale.views.in_ipython_frontend", return_value=True
              )
          )
          build_data_inst({"9999": df})
          instance = DtaleData("9999", "http://localhost:9999")
          instance.notebook_correlations(col1="col1", col2="col2")
          mock_iframe.assert_called_once()
  
          url_parser = get_url_parser()
          [path, query] = mock_iframe.call_args[0][0].split("?")
          assert (
              path
              == "http://localhost:9999/dtale/popup/correlations/9999"
          )
          assert dict(url_parser(query)) == dict(
              col1="col1", col2="col2"
          )
  
          instance.notebook_charts(
              x="col1", y="col2", group=["col3", "col4"], agg="count"
          )
          [path, query] = mock_iframe.call_args[0][0].split("?")
          assert path == "http://localhost:9999/dtale/charts/9999"
          assert dict(url_parser(query)) == dict(
              chart_type="line",
              agg="count",
              group='["col3", "col4"]',
              x="col1",
              y='["col2"]',
              cpg="false",
              cpy="false",
              animate="false",
          )
  
          instance.notebook_charts(x="col1", y="col2", agg="count")
          [_path, query] = mock_iframe.call_args[0][0].split("?")
          assert dict(url_parser(query)) == dict(
              chart_type="line",
              agg="count",
              x="col1",
              y='["col2"]',
              cpg="false",
              cpy="false",
              animate="false",
          )
  
          instance.notebook_charts(
              x="col1", y="col2", group=["col3", "col4"]
          )
          [_path, query] = mock_iframe.call_args[0][0].split("?")
          assert dict(url_parser(query)) == dict(
              chart_type="line",
              x="col1",
              y='["col2"]',
              group='["col3", "col4"]',
              cpg="false",
              cpy="false",
              animate="false",
          )
  
file_path: dtale/tests/dtale/test_instance.py
imports: from collections import namedtuple
  import mock
  import pandas
  import pytest
  from dtale.dash_application.charts import get_url_parser
  from tests import ExitStack
  from tests.dtale import build_data_inst
label_desc: Use image node_id 2 for calling a global function with example usage: test_ipython_notebook_funcs() and returns: getter