code: def test_error_on_invalid_inputs(metric_class=TweedieDevianceScore):
      """Test that error is raised on wrong argument combinations."""
      with pytest.raises(
          ValueError,
          match="Deviance Score is not defined for power=0.5.",
      ):
          metric_class(power=0.5)
  
      metric = metric_class(power=1)
      with pytest.raises(
          ValueError,
          match="For power=1, 'preds' has to be strictly positive and 'targets' cannot be negative.",
      ):
          metric(torch.tensor([-1.0, 2.0, 3.0]), torch.rand(3))
  
      with pytest.raises(
          ValueError,
          match="For power=1, 'preds' has to be strictly positive and 'targets' cannot be negative.",
      ):
          metric(torch.rand(3), torch.tensor([-1.0, 2.0, 3.0]))
  
      metric = metric_class(power=2)
      with pytest.raises(
          ValueError,
          match="For power=2, both 'preds' and 'targets' have to be strictly positive.",
      ):
          metric(torch.tensor([-1.0, 2.0, 3.0]), torch.rand(3))
  
      with pytest.raises(
          ValueError,
          match="For power=2, both 'preds' and 'targets' have to be strictly positive.",
      ):
          metric(torch.rand(3), torch.tensor([-1.0, 2.0, 3.0]))
  
imports: from functools import partial
  import pytest
  import torch
  from sklearn.metrics import mean_tweedie_deviance
  from torch import Tensor
  from torchmetrics.functional.regression.tweedie_deviance import tweedie_deviance_score
  from torchmetrics.regression.tweedie_deviance import TweedieDevianceScore
  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 3 for calling a global function with example usage: test_error_on_invalid_inputs(metric_class) without return types