MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_examples

Method get_examples

tools/python-3.11.9-amd64/Lib/doctest.py:681–693  ·  view source on GitHub ↗

Extract all doctest examples from the given string, and return them as a list of `Example` objects. Line numbers are 0-based, because it's most common in doctests that nothing interesting appears on the same line as opening triple-quote, and so the firs

(self, string, name='<string>')

Source from the content-addressed store, hash-verified

679 name, filename, lineno, string)
680
681 def get_examples(self, string, name='<string>'):
682 """
683 Extract all doctest examples from the given string, and return
684 them as a list of `Example` objects. Line numbers are
685 0-based, because it&#x27;s most common in doctests that nothing
686 interesting appears on the same line as opening triple-quote,
687 and so the first interesting line is called \"line 1\" then.
688
689 The optional argument `name` is a name identifying this
690 string, and is only used for error messages.
691 """
692 return [x for x in self.parse(string, name)
693 if isinstance(x, Example)]
694
695 def _parse_example(self, m, name, lineno):
696 """

Callers 1

get_doctestMethod · 0.95

Calls 1

parseMethod · 0.95

Tested by

no test coverage detected