code: def test_slice(self):
      def callback(indices, key_indices):
          if isinstance(self.indices, list) or isinstance(
              self.get_examples_indices, list
          ):
              self.assertIsInstance(indices, list)
          elif isinstance(self.indices, slice) or isinstance(
              self.get_examples_indices, slice
          ):
              self.assertIsInstance(indices, slice)
          else:
              self.assertIsNone(indices)
  
          if (
              self.keys is None
              and self.get_examples_key_indices is None
          ):
              self.assertIsNone(key_indices)
          else:
              self.assertIsInstance(key_indices, tuple)
  
      dataset = dummy_dataset.DummyDataset(
          mode=self.mode,
          return_array=self.return_array,
          callback=callback,
          convert=True,
      )
  
      if self.exception is not None:
          with self.assertRaises(self.exception):
              if self.keys is None:
                  dataset.slice[self.indices]
              else:
                  dataset.slice[self.indices, self.keys]
          return
  
      if self.keys is None:
          view = dataset.slice[self.indices]
          data = dataset.data[:, _indices_for_numpy(self.indices)]
      else:
          view = dataset.slice[self.indices, self.keys]
          if isinstance(self.keys, tuple):
              keys = self.keys
          else:
              keys = (self.keys,)
          key_indices = [
              {"a": 0, "b": 1, "c": 2}.get(key, key) for key in keys
          ]
          data = dataset.data[key_indices][
              :, _indices_for_numpy(self.indices)
          ]
  
      self.assertIsInstance(view, chainer.dataset.TabularDataset)
      self.assertEqual(len(view), self.expected_len)
      self.assertEqual(view.keys, self.expected_keys)
      if self.keys is None:
          self.assertEqual(view.mode, self.mode)
      elif isinstance(self.keys, tuple):
          self.assertEqual(view.mode, self.mode or tuple)
      else:
          self.assertEqual(view.mode, None)
  
      output = view.get_examples(
          self.get_examples_indices, self.get_examples_key_indices
      )
  
      if self.get_examples_indices is not None:
          data = data[:, _indices_for_numpy(self.get_examples_indices)]
      if self.get_examples_key_indices is not None:
          data = data[list(self.get_examples_key_indices)]
  
      for out, d in six.moves.zip_longest(output, data):
          np.testing.assert_equal(out, d)
          if self.return_array:
              self.assertIsInstance(out, np.ndarray)
          else:
              self.assertIsInstance(out, list)
  
      self.assertEqual(view.convert(output), "converted")
  
file_path: chainer/tests/chainer_tests/dataset_tests/tabular_tests/test_slice.py
imports: import unittest
  import warnings
  import numpy
  import six
  import chainer
  from chainer import testing
  from chainer_tests.dataset_tests.tabular_tests import dummy_dataset
label_desc: Use image node_id 2 for calling the TestSlice obj's underlying member method code with example usage: obj.test_slice() without return types