MCPcopy Index your code
hub / github.com/python/cpython / get_examples

Method get_examples

Lib/doctest.py:702–714  ·  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 first int

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

Source from the content-addressed store, hash-verified

700 name, filename, lineno, string)
701
702 def get_examples(self, string, name='<string>'):
703 """
704 Extract all doctest examples from the given string, and return
705 them as a list of `Example` objects. Line numbers are
706 0-based, because it&#x27;s most common in doctests that nothing
707 interesting appears on the same line as opening triple-quote,
708 and so the first interesting line is called \"line 1\" then.
709
710 The optional argument `name` is a name identifying this
711 string, and is only used for error messages.
712 """
713 return [x for x in self.parse(string, name)
714 if isinstance(x, Example)]
715
716 def _parse_example(self, m, name, lineno):
717 """

Callers 1

get_doctestMethod · 0.95

Calls 1

parseMethod · 0.95

Tested by

no test coverage detected