code: def test_getitem(self):
      with patch.dict(self.dispatcher.funcs, {}):
          self.dispatcher.add(
              signature=(int, str), func=lambda *_: None
          )
  
          args = 0, "a"
          types = self.dispatcher.encode_args(args)
          with self.assertRaisesRegex(
              RuntimeError, "One of `args` or `types`"
          ):
              self.dispatcher.__getitem__(args=None, types=None)
  
          with self.assertRaisesRegex(
              RuntimeError, "Only one of `args` or `types`"
          ):
              self.dispatcher.__getitem__(args=args, types=types)
  
          self.assertEqual(
              self.dispatcher[args],
              self.dispatcher.__getitem__(args=args),
          )
  
          self.assertEqual(
              self.dispatcher[args],
              self.dispatcher.__getitem__(types=types),
          )
  
file_path: botorch/test/utils/test_dispatcher.py
imports: from __future__ import annotations
  from contextlib import redirect_stdout
  from inspect import getsource, getsourcefile
  from io import StringIO
  from itertools import product
  from unittest.mock import patch
  from botorch.utils.dispatcher import Dispatcher, MDNotImplementedError
  from botorch.utils.testing import BotorchTestCase
label_desc: Use image node_id 3 for calling the TestDispatcher obj's underlying member method code with example usage: obj.test_getitem() without return types