docstr: Tests whether the dataset_shard function raises an error when both format
  and loader_fn are specified.
docstr_tok: ["Tests","whether","the","dataset_shard","function","raises","an","error","when","both","format","and","loader_fn","are","specified","."]
code: def test_dataset_shard_error_with_both_format_and_loader_fn(self):
      """Tests whether the dataset_shard function raises an error when both format
      and loader_fn are specified."""
      dset = ray.data.range(100)
  
      config = AlgorithmConfig().offline_data(
          input_="dataset",
          input_config={
              "format": "json",
              "paths": self.dset_path,
              "loader_fn": lambda: dset,
          },
      )
  
      with self.assertRaises(ValueError):
          get_dataset_and_shards(config)
  
imports: import tempfile
  import os
  from pathlib import Path
  import unittest
  import pytest
  import ray
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig
  from ray.rllib.offline import IOContext
  from ray.rllib.offline.dataset_reader import DatasetReader, get_dataset_and_shards, _unzip_if_needed
label_desc: Use image node_id 9 for calling the TestDatasetReader obj's underlying member method code with example usage: obj.test_dataset_shard_error_with_both_format_and_loader_fn() without return types