code: def test_label():
      """
      Test the introspection and creation of CIFTI-2 ScalarAxis axes
      """
      lab = get_label()
      assert len(lab) == 3
      assert isinstance(lab, axes.LabelAxis)
      assert (lab.name == ["one", "two", "three"]).all()
      assert (lab.meta == [{}] * 3).all()
      assert (lab.label == [use_label] * 3).all()
      assert lab[1] == ("two", use_label, {})
      lab2 = lab + lab
      assert len(lab2) == 6
      assert (
          lab2.name == ["one", "two", "three", "one", "two", "three"]
      ).all()
      assert (lab2.meta == [{}] * 6).all()
      assert (lab2.label == [use_label] * 6).all()
      assert lab2[:3] == lab
      assert lab2[3:] == lab
  
      # test equalities
      lab = get_label()
      assert lab != get_scalar()
      with pytest.raises(Exception):
          lab + get_scalar()
  
      other_lab = deepcopy(lab)
      assert lab != other_lab[:2]
      assert lab == other_lab[:]
      other_lab.name[0] = "new_name"
      assert lab != other_lab
  
      other_lab = deepcopy(lab)
      other_lab.meta[0]["new_key"] = "new_item"
      assert "new_key" not in other_lab.meta[1]
      assert lab != other_lab
      lab.meta[0]["new_key"] = "new_item"
      assert lab == other_lab
  
      other_lab = deepcopy(lab)
      other_lab.label[0][20] = ("new_label", (0, 0, 0, 1))
      assert lab != other_lab
      assert 20 not in other_lab.label[1]
      lab.label[0][20] = ("new_label", (0, 0, 0, 1))
      assert lab == other_lab
  
      # test constructor
      assert axes.LabelAxis(
          ["scalar_name"], [{}], [{}]
      ) == axes.LabelAxis(["scalar_name"], [{}])
  
      with pytest.raises(ValueError):
          axes.LabelAxis([["scalar_name"]], [{}])  # wrong shape
  
      with pytest.raises(ValueError):
          axes.LabelAxis(["scalar_name"], [{}, {}])
  
file_path: nibabel/nibabel/cifti2/tests/test_axes.py
imports: from copy import deepcopy
  import numpy
  import pytest
  import nibabel.cifti2.cifti2_axes
  from .test_cifti2io_axes import check_rewrite
label_desc: Use image node_id 10 for calling a global function with example usage: test_label() without return types