class_docstr: Test class for `EditDistance` metric.
docstr: Test class implementation of metric.
docstr_tok: ["Test","class","implementation","of","metric","."]
code: def test_edit_class(
      self, preds, targets, ddp, substitution_cost, reduction
  ):
      """Test class implementation of metric."""
      if ddp and reduction == "none":
          pytest.skip(
              "DDP not available for reduction='none' because order of outputs is not guaranteed."
          )
      self.run_class_metric_test(
          ddp=ddp,
          preds=preds,
          targets=targets,
          metric_class=EditDistance,
          reference_metric=partial(
              _ref_implementation,
              substitution_cost=substitution_cost,
              reduction=reduction,
          ),
          metric_args={
              "substitution_cost": substitution_cost,
              "reduction": reduction,
          },
      )
  
file_path: torchmetrics/tests/unittests/text/test_edit.py
imports: from functools import partial
  import pytest
  from nltk.metrics.distance import edit_distance
  from torchmetrics.functional.text.edit import edit_distance
  from torchmetrics.text.edit import EditDistance
  from unittests.text.helpers import TextTester
  from unittests.text.inputs import _inputs_single_reference
label_desc: Use image node_id 1 for calling the TestEditDistance obj's underlying member method code with example usage: obj.test_edit_class(preds, targets, ddp, substitution_cost, reduction) without return types