code: def test_with_index():
      tips = px.data.tips()
      fig = px.scatter(tips, x=tips.index, y="total_bill")
      assert (
          fig.data[0]["hovertemplate"]
          == "index=%{x}<br>total_bill=%{y}<extra></extra>"
      )
      fig = px.scatter(tips, x=tips.index, y=tips.total_bill)
      assert (
          fig.data[0]["hovertemplate"]
          == "index=%{x}<br>total_bill=%{y}<extra></extra>"
      )
      fig = px.scatter(
          tips,
          x=tips.index,
          y=tips.total_bill,
          labels={"index": "number"},
      )
      assert (
          fig.data[0]["hovertemplate"]
          == "number=%{x}<br>total_bill=%{y}<extra></extra>"
      )
      # We do not allow "x=index"
      with pytest.raises(ValueError) as err_msg:
          fig = px.scatter(tips, x="index", y="total_bill")
      assert (
          "To use the index, pass it in directly as `df.index`."
          in str(err_msg.value)
      )
      tips = px.data.tips()
      tips.index.name = "item"
      fig = px.scatter(tips, x=tips.index, y="total_bill")
      assert (
          fig.data[0]["hovertemplate"]
          == "item=%{x}<br>total_bill=%{y}<extra></extra>"
      )
  
imports: import plotly.express
  import plotly.graph_objects
  import numpy
  import pandas
  import pytest
  from packaging import version
  import unittest.mock
  from plotly.express._core import build_dataframe
  from pandas.testing import assert_frame_equal
label_desc: Use image node_id 4 for calling a global function with example usage: test_with_index() without return types