code: def repr_failure(self, excinfo):
      import doctest
  
      failures = None
      if excinfo.errisinstance(
          (doctest.DocTestFailure, doctest.UnexpectedException)
      ):
          failures = [excinfo.value]
      elif excinfo.errisinstance(MultipleDoctestFailures):
          failures = excinfo.value.failures
  
      if failures is not None:
          reprlocation_lines = []
          for failure in failures:
              example = failure.example
              test = failure.test
              filename = test.filename
              if test.lineno is None:
                  lineno = None
              else:
                  lineno = test.lineno + example.lineno + 1
              message = type(failure).__name__
              reprlocation = ReprFileLocation(filename, lineno, message)
              checker = _get_checker()
              report_choice = _get_report_choice(
                  self.config.getoption("doctestreport")
              )
              if lineno is not None:
                  lines = failure.test.docstring.splitlines(False)
                  # add line numbers to the left of the error message
                  lines = [
                      "%03d %s" % (i + test.lineno + 1, x)
                      for (i, x) in enumerate(lines)
                  ]
                  # trim docstring error lines to 10
                  lines = lines[
                      max(example.lineno - 9, 0) : example.lineno + 1
                  ]
              else:
                  lines = [
                      "EXAMPLE LOCATION UNKNOWN, not showing all tests of that example"
                  ]
                  indent = ">>>"
                  for line in example.source.splitlines():
                      lines.append("??? %s %s" % (indent, line))
                      indent = "..."
              if isinstance(failure, doctest.DocTestFailure):
                  lines += checker.output_difference(
                      example, failure.got, report_choice
                  ).split("\n")
              else:
                  inner_excinfo = ExceptionInfo(failure.exc_info)
                  lines += [
                      "UNEXPECTED EXCEPTION: %s"
                      % repr(inner_excinfo.value)
                  ]
                  lines += traceback.format_exception(*failure.exc_info)
              reprlocation_lines.append((reprlocation, lines))
          return ReprFailDoctest(reprlocation_lines)
      else:
          return super(DoctestItem, self).repr_failure(excinfo)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import inspect
  import platform
  import sys
  import traceback
  import warnings
  from contextlib import contextmanager
  import pytest
  from _pytest._code.code import ExceptionInfo
  from _pytest._code.code import ReprFileLocation
  from _pytest._code.code import TerminalRepr
  from _pytest.compat import safe_getattr
  from _pytest.fixtures import FixtureRequest
  from _pytest.outcomes import Skipped
  from _pytest.warning_types import PytestWarning
label_desc: Use image node_id 5 for calling the DoctestItem obj's underlying member method code with example usage: obj.repr_failure(excinfo) and returns: ReprFailDoctest, super