code: def test_label_addition():
      """Test label addition."""
      pos = np.random.RandomState(0).rand(10, 3)
      values = np.arange(10.0) / 10
      idx0 = list(range(7))
      idx1 = list(range(7, 10))  # non-overlapping
      idx2 = list(range(5, 10))  # overlapping
      l0 = Label(idx0, pos[idx0], values[idx0], "lh", color="red")
      l1 = Label(idx1, pos[idx1], values[idx1], "lh")
      l2 = Label(
          idx2, pos[idx2], values[idx2], "lh", color=(0, 1, 0, 0.5)
      )
  
      assert_equal(len(l0), len(idx0))
  
      l_good = l0.copy()
      l_good.subject = "sample"
      l_bad = l1.copy()
      l_bad.subject = "foo"
      pytest.raises(ValueError, l_good.__add__, l_bad)
      pytest.raises(TypeError, l_good.__add__, "foo")
      pytest.raises(ValueError, l_good.__sub__, l_bad)
      pytest.raises(TypeError, l_good.__sub__, "foo")
  
      # adding non-overlapping labels
      l01 = l0 + l1
      assert_equal(len(l01), len(l0) + len(l1))
      assert_array_equal(l01.values[: len(l0)], l0.values)
      assert_equal(l01.color, l0.color)
      # subtraction
      assert_labels_equal(l01 - l0, l1, comment=False, color=False)
      assert_labels_equal(l01 - l1, l0, comment=False, color=False)
  
      # adding overlapping labels
      l02 = l0 + l2
      i0 = np.where(l0.vertices == 6)[0][0]
      i2 = np.where(l2.vertices == 6)[0][0]
      i = np.where(l02.vertices == 6)[0][0]
      assert_equal(l02.values[i], l0.values[i0] + l2.values[i2])
      assert_equal(l02.values[0], l0.values[0])
      assert_array_equal(
          np.unique(l02.vertices), np.unique(idx0 + idx2)
      )
      assert_equal(l02.color, _blend_colors(l0.color, l2.color))
  
      # adding lh and rh
      l2.hemi = "rh"
      bhl = l0 + l2
      assert_equal(bhl.hemi, "both")
      assert_equal(len(bhl), len(l0) + len(l2))
      assert_equal(bhl.color, l02.color)
      assert "BiHemiLabel" in repr(bhl)
      # subtraction
      assert_labels_equal(bhl - l0, l2)
      assert_labels_equal(bhl - l2, l0)
  
      bhl2 = l1 + bhl
      assert_labels_equal(bhl2.lh, l01)
      assert_equal(bhl2.color, _blend_colors(l1.color, bhl.color))
      assert_array_equal(
          (l2 + bhl).rh.vertices, bhl.rh.vertices
      )  # rh label
      assert_array_equal((bhl + bhl).lh.vertices, bhl.lh.vertices)
      pytest.raises(TypeError, bhl.__add__, 5)
  
      # subtraction
      bhl_ = bhl2 - l1
      assert_labels_equal(bhl_.lh, bhl.lh, comment=False, color=False)
      assert_labels_equal(bhl_.rh, bhl.rh)
      assert_labels_equal(bhl2 - l2, l0 + l1)
      assert_labels_equal(bhl2 - l1 - l0, l2)
      bhl_ = bhl2 - bhl2
      assert_array_equal(bhl_.vertices, [])
  
imports: import glob
  import os
  import pickle
  import shutil
  from itertools import product
  from pathlib import Path
  import numpy
  import pytest
  from numpy.testing import assert_allclose, assert_array_almost_equal, assert_array_equal, assert_array_less, assert_equal
  from scipy import sparse
  from mne import grow_labels, labels_to_stc, morph_labels, random_parcellation, read_label, read_labels_from_annot, read_source_estimate, read_source_spaces, read_surface, spatial_tris_adjacency, split_label, stc_to_label, write_labels_to_annot
  from mne.datasets import testing
  from mne.label import Label, _blend_colors, _load_vert_pos, _n_colors, _read_annot, _read_annot_cands, label_sign_flip, select_sources
  from mne.source_estimate import mesh_edges
  from mne.source_space import SourceSpaces
  from mne.surface import _mesh_borders
  from mne.utils import _record_warnings, get_subjects_dir
label_desc: Use image node_id 5 for calling a global function with example usage: test_label_addition() without return types