code: def test_item_metadata_exceptions():
      class MyDataset(BaseDataset):
          def __getitem__(self, sample_size_and_index: Any) -> Any:
              return 2
  
      opts = get_config()
      dataset = MyDataset(opts)
      # Make sure datasets that don't need item_metadata work without exception:
      assert dataset[0] == 2
  
      # The proper error to be raised is NotImplementedError, so that the users know they
      # should implement which method
      with pytest.raises(NotImplementedError):
          dataset.get_item_metadata(0)
  
imports: from typing import Any, Union
  import pytest
  from data.datasets.dataset_base import BaseDataset
  from tests.configs import get_config
  from tests.data.datasets.classification.mock_imagenet import MockImageNetDataset
label_desc: Use image node_id 3 for calling a global function with example usage: test_item_metadata_exceptions() and returns: int