MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_examples

Method get_examples

Lib/doctest.py:708–720  ·  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

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

Callers 1

get_doctestMethod · 0.95

Calls 2

parseMethod · 0.95
isinstanceFunction · 0.85

Tested by

no test coverage detected