code: def collect(self):
      import doctest
  
      # inspired by doctest.testfile; ideally we would use it directly,
      # but it doesn't support passing a custom checker
      encoding = self.config.getini("doctest_encoding")
      text = self.fspath.read_text(encoding)
      filename = str(self.fspath)
      name = self.fspath.basename
      globs = {"__name__": "__main__"}
  
      optionflags = get_optionflags(self)
  
      runner = _get_runner(
          verbose=0,
          optionflags=optionflags,
          checker=_get_checker(),
          continue_on_failure=_get_continue_on_failure(self.config),
      )
      _fix_spoof_python2(runner, encoding)
  
      parser = doctest.DocTestParser()
      test = parser.get_doctest(text, globs, name, filename, 0)
      if test.examples:
          yield DoctestItem(test.name, self, runner, test)
  
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 1 for calling the DoctestTextfile obj's underlying member method code with example usage: obj.collect() without return types