code: def test_missing_data_range():
      """Check that error is raised if data range is not provided."""
      with pytest.raises(
          ValueError,
          match="The `data_range` must be given when `dim` is not None.",
      ):
          PeakSignalNoiseRatio(data_range=None, dim=0)
  
      with pytest.raises(
          ValueError,
          match="The `data_range` must be given when `dim` is not None.",
      ):
          peak_signal_noise_ratio(
              _inputs[0].preds,
              _inputs[0].target,
              data_range=None,
              dim=0,
          )
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from skimage.metrics import peak_signal_noise_ratio
  from torchmetrics.functional import peak_signal_noise_ratio
  from torchmetrics.image import PeakSignalNoiseRatio
  from torchmetrics.utilities.imports import _TORCH_GREATER_EQUAL_2_1
  from unittests import BATCH_SIZE, NUM_BATCHES, _Input
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester
label_desc: Use image node_id 5 for calling a global function with example usage: test_missing_data_range() without return types