code: def test_sunburst_treemap_with_path():
      vendors = ["A", "B", "C", "D", "E", "F", "G", "H"]
      sectors = [
          "Tech",
          "Tech",
          "Finance",
          "Finance",
          "Tech",
          "Tech",
          "Finance",
          "Finance",
      ]
      regions = [
          "North",
          "North",
          "North",
          "North",
          "South",
          "South",
          "South",
          "South",
      ]
      values = [1, 3, 2, 4, 2, 2, 1, 4]
      total = ["total"] * 8
      df = pd.DataFrame(
          dict(
              vendors=vendors,
              sectors=sectors,
              regions=regions,
              values=values,
              total=total,
          )
      )
      path = ["total", "regions", "sectors", "vendors"]
      # No values
      fig = px.sunburst(df, path=path)
      assert fig.data[0].branchvalues == "total"
      # Values passed
      fig = px.sunburst(df, path=path, values="values")
      assert fig.data[0].branchvalues == "total"
      assert fig.data[0].values[-1] == np.sum(values)
      # Values passed
      fig = px.sunburst(df, path=path, values="values")
      assert fig.data[0].branchvalues == "total"
      assert fig.data[0].values[-1] == np.sum(values)
      # Error when values cannot be converted to numerical data type
      df["values"] = [
          "1 000",
          "3 000",
          "2",
          "4",
          "2",
          "2",
          "1 000",
          "4 000",
      ]
      msg = "Column `values` of `df` could not be converted to a numerical data type."
      with pytest.raises(ValueError, match=msg):
          fig = px.sunburst(df, path=path, values="values")
      #  path is a mixture of column names and array-like
      path = [df.total, "regions", df.sectors, "vendors"]
      fig = px.sunburst(df, path=path)
      assert fig.data[0].branchvalues == "total"
      # Continuous colorscale
      df["values"] = 1
      fig = px.sunburst(df, path=path, values="values", color="values")
      assert "coloraxis" in fig.data[0].marker
      assert np.all(np.array(fig.data[0].marker.colors) == 1)
      assert fig.data[0].values[-1] == 8
  
file_path: plotly.py/packages/python/plotly/plotly/tests/test_optional/test_px/test_px_functions.py
imports: import plotly.express
  import plotly.graph_objects
  from numpy.testing import assert_array_equal
  import numpy
  import pandas
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_sunburst_treemap_with_path() without return types