code: def test_corner_cases():
      """Test corner cases for specificity metric."""
      # simulate the output of a perfect predictor (i.e. preds == target)
      target = torch.tensor([0, 1, 2, 0, 1, 2])
      preds = target
  
      metric = MulticlassSpecificity(
          num_classes=3, average="none", ignore_index=0
      )
      res = metric(preds, target)
      assert torch.allclose(res, torch.tensor([1.0, 1.0, 1.0]))
  
      metric = MulticlassSpecificity(
          num_classes=3, average="macro", ignore_index=0
      )
      res = metric(preds, target)
      assert res == 1.0
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.metrics import confusion_matrix
  from torch import Tensor, tensor
  from torchmetrics.classification.specificity import BinarySpecificity, MulticlassSpecificity, MultilabelSpecificity, Specificity
  from torchmetrics.functional.classification.specificity import binary_specificity, multiclass_specificity, multilabel_specificity
  from torchmetrics.metric import Metric
  from unittests import NUM_CLASSES, THRESHOLD
  from unittests.classification.inputs import _binary_cases, _multiclass_cases, _multilabel_cases
  from unittests.helpers import seed_all
  from unittests.helpers.testers import MetricTester, inject_ignore_index
label_desc: Use image node_id 10 for calling a global function with example usage: test_corner_cases() without return types