code: def test_simulate_stc_labels_overlap(_get_fwd_labels):
      """Test generation of source estimate, overlapping labels."""
      fwd, labels = _get_fwd_labels
      mylabels = []
      for i, label in enumerate(labels):
          new_label = Label(
              vertices=label.vertices,
              pos=label.pos,
              values=2 * i * np.ones(len(label.values)),
              hemi=label.hemi,
              comment=label.comment,
          )
          mylabels.append(new_label)
      # Adding the last label twice
      mylabels.append(new_label)
  
      n_times = 10
      tmin = 0
      tstep = 1e-3
  
      stc_data = np.ones((len(mylabels), n_times))
  
      # Test false
      with pytest.raises(RuntimeError, match="must be non-overlapping"):
          simulate_stc(
              fwd["src"],
              mylabels,
              stc_data,
              tmin,
              tstep,
              allow_overlap=False,
          )
      # test True
      stc = simulate_stc(
          fwd["src"],
          mylabels,
          stc_data,
          tmin,
          tstep,
          allow_overlap=True,
      )
      assert_equal(stc.subject, "sample")
      assert stc.data.shape[1] == n_times
      # Some of the elements should be equal to 2 since we have duplicate labels
      assert 2 in stc.data
  
file_path: mne-python/mne/simulation/tests/test_source.py
imports: import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal, assert_equal
  from mne import convert_forward_solution, pick_types_forward, read_forward_solution, read_label
  from mne.datasets import testing
  from mne.label import Label
  from mne.simulation import SourceSimulator, simulate_sparse_stc, simulate_stc
label_desc: Use image node_id 7 for calling a global function with example usage: test_simulate_stc_labels_overlap(_get_fwd_labels) without return types