code: def test_add_trace_exclude_empty_subplots():
      # Add traces
      fig = make_subplots(2, 2)
      fig.add_trace(go.Scatter(x=[1, 2, 3], y=[5, 1, 2]), row=1, col=1)
      fig.add_trace(go.Scatter(x=[1, 2, 3], y=[2, 1, -7]), row=2, col=2)
      # Add traces with exclude_empty_subplots set to true and make sure this
      # doesn't add to traces that don't already have data
      fig.add_trace(
          go.Scatter(x=[1, 2, 3], y=[0, 1, -1]),
          row="all",
          col="all",
          exclude_empty_subplots=True,
      )
      assert len(fig.data) == 4
      assert fig.data[2]["xaxis"] == "x" and fig.data[2]["yaxis"] == "y"
      assert (
          fig.data[3]["xaxis"] == "x4" and fig.data[3]["yaxis"] == "y4"
      )
  
file_path: plotly.py/packages/python/plotly/plotly/tests/test_core/test_figure_messages/test_add_traces.py
imports: import sys
  from unittest import TestCase
  import plotly.graph_objs
  from plotly.subplots import make_subplots
label_desc: Use image node_id 1 for calling a global function with example usage: test_add_trace_exclude_empty_subplots() without return types