code: def test_corner_cases(metric_fn, preds, target, expected):
      """Test the corner cases of perfect classifiers or completely random classifiers that they work as expected."""
      out = metric_fn(preds, target)
      assert out == expected
  
imports: from functools import partial
  import numpy
  import pytest
  import torch
  from scipy.special import expit
  from sklearn.metrics import matthews_corrcoef
  from torchmetrics.classification.matthews_corrcoef import BinaryMatthewsCorrCoef, MatthewsCorrCoef, MulticlassMatthewsCorrCoef, MultilabelMatthewsCorrCoef
  from torchmetrics.functional.classification.matthews_corrcoef import binary_matthews_corrcoef, multiclass_matthews_corrcoef, multilabel_matthews_corrcoef
  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, remove_ignore_index
label_desc: Use image node_id 5 for calling a global function with example usage: test_corner_cases(metric_fn, preds, target, expected) without return types