code: def test_getitem(self):
      sdict = PerArrayDict(
          len(DATA["tractogram"]), DATA["data_per_streamline"]
      )
  
      with pytest.raises(KeyError):
          sdict["invalid"]
  
      # Test slicing and advanced indexing.
      for k, v in DATA["tractogram"].data_per_streamline.items():
          assert k in sdict
          assert_arrays_equal(sdict[k], v)
          assert_arrays_equal(sdict[::2][k], v[::2])
          assert_arrays_equal(sdict[::-1][k], v[::-1])
          assert_arrays_equal(sdict[-1][k], v[-1])
          assert_arrays_equal(sdict[[0, -1]][k], v[[0, -1]])
  
imports: import copy
  import operator
  import sys
  import unittest
  import warnings
  from collections import defaultdict
  import numpy
  import pytest
  from numpy.testing import assert_array_almost_equal, assert_array_equal
  from ...testing import assert_arrays_equal, clear_and_catch_warnings
  from ..None import tractogram
  from ..tractogram import LazyDict, LazyTractogram, PerArrayDict, PerArraySequenceDict, Tractogram, TractogramItem, is_data_dict, is_lazy_dict
label_desc: Use image node_id 2 for calling the TestPerArrayDict obj's underlying member method code with example usage: obj.test_getitem() without return types