code: def test_scalar():
      """
      Test the introspection and creation of CIFTI-2 ScalarAxis axes
      """
      sc = get_scalar()
      assert len(sc) == 3
      assert isinstance(sc, axes.ScalarAxis)
      assert (sc.name == ["one", "two", "three"]).all()
      assert (sc.meta == [{}] * 3).all()
      assert sc[1] == ("two", {})
      sc2 = sc + sc
      assert len(sc2) == 6
      assert (
          sc2.name == ["one", "two", "three", "one", "two", "three"]
      ).all()
      assert (sc2.meta == [{}] * 6).all()
      assert sc2[:3] == sc
      assert sc2[3:] == sc
  
      sc.meta[1]["a"] = 3
      assert "a" not in sc.meta
  
      # test equalities
      assert sc != get_label()
      with pytest.raises(Exception):
          sc + get_label()
  
      sc_other = deepcopy(sc)
      assert sc == sc_other
      assert sc != sc_other[:2]
      assert sc == sc_other[:]
      sc_other.name[0] = "new_name"
      assert sc != sc_other
  
      sc_other = deepcopy(sc)
      sc_other.meta[0]["new_key"] = "new_entry"
      assert sc != sc_other
      sc.meta[0]["new_key"] = "new_entry"
      assert sc == sc_other
  
      # test constructor
      assert axes.ScalarAxis(["scalar_name"], [{}]) == axes.ScalarAxis(
          ["scalar_name"]
      )
  
      with pytest.raises(ValueError):
          axes.ScalarAxis([["scalar_name"]])  # wrong shape
  
      with pytest.raises(ValueError):
          axes.ScalarAxis(["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 9 for calling a global function with example usage: test_scalar() without return types