code: def test_trendline_on_timeseries(mode, options):
      df = px.data.stocks()
  
      with pytest.raises(ValueError) as err_msg:
          px.scatter(
              df,
              x="date",
              y="GOOG",
              trendline=mode,
              trendline_options=options,
          )
      assert (
          "Could not convert value of 'x' ('date') into a numeric type."
          in str(err_msg.value)
      )
  
      df["date"] = pd.to_datetime(df["date"])
      df["date"] = df["date"].dt.tz_localize("CET")  # force a timezone
      fig = px.scatter(
          df,
          x="date",
          y="GOOG",
          trendline=mode,
          trendline_options=options,
      )
      assert len(fig.data) == 2
      assert len(fig.data[0].x) == len(fig.data[1].x)
      assert type(fig.data[0].x[0]) == datetime
      assert type(fig.data[1].x[0]) == datetime
      assert np.all(fig.data[0].x == fig.data[1].x)
      assert str(fig.data[0].x[0]) == str(fig.data[1].x[0])
  
file_path: plotly.py/packages/python/plotly/plotly/tests/test_optional/test_px/test_trendline.py
imports: import plotly.express
  import numpy
  import pandas
  import pytest
  from datetime import datetime
label_desc: Use image node_id 5 for calling a global function with example usage: test_trendline_on_timeseries(mode, options) without return types