Lines Matching refs:examples
9 r"""Module doctest -- a framework for running examples in docstrings.
20 Then running the module as a script will cause the examples in the
34 and a detailed report of all examples tried is printed to stdout, along
108 # - DocTest: a collection of examples, parsed from a docstring, plus
165 # 3. DocTest Parser -- extracts examples from strings
397 ## - A "doctest" is a collection of examples, typically extracted from
475 A collection of doctest examples that should be run in a single
478 - examples: the list of examples.
480 - globs: The namespace (aka globals) that the examples should
494 - docstring: The string that the examples were extracted from,
497 def __init__(self, examples, globs, name, filename, lineno, docstring):
499 Create a new DocTest containing the given examples. The
502 assert not isinstance(examples, basestring), \
504 self.examples = examples
512 if len(self.examples) == 0:
513 examples = 'no examples'
514 elif len(self.examples) == 1:
515 examples = '1 example'
517 examples = '%d examples' % len(self.examples)
519 (self.name, self.filename, self.lineno, examples))
525 return self.examples == other.examples and \
551 A class used to parse strings containing doctest examples.
553 # This regular expression is used to find doctest examples in a
599 Divide the given string into examples and intervening text,
600 and return them as a list of alternating Examples and strings.
601 Line numbers for the Examples are 0-based. The optional
613 # Find all doctest examples in the string:
638 Extract all doctest examples from the given string, and
650 Extract all doctest examples from the given string, and return
1112 The aggregated number of tried examples and failed examples is
1146 outputs of doctest examples.
1164 # Keep track of the examples we've run.
1233 Run the examples in `test`. Write the outcome of each example
1236 flags that should be used to execute examples. Return a tuple
1237 `(f, t)`, where `t` is the number of examples tried, and `f`
1238 is the number of examples that failed. The examples
1253 for examplenum, example in enumerate(test.examples):
1358 failures out of `t` tried examples.
1371 example = self.test.examples[int(m.group('examplenum'))]
1381 Run the examples in `test`, and display the results using the
1384 The examples are run in the namespace `test.globs`. If
1391 the Python compiler when running the examples. If not
1445 the total number of failed examples, and `t` is the total
1446 number of tried examples.
1753 UnexpectedException: <DocTest foo from foo.py:0 (2 examples)>
1801 Test examples in docstrings in functions and classes reachable
1805 Also test examples reachable from dict m.__test__ if it exists and is
1818 when executing examples; by default, use m.__dict__. A copy of this
1820 examples start with a clean slate.
1823 merged into the globals that are used to execute examples. By
1903 Test examples in the given file. Return (#failures, #tests).
1931 when executing examples; by default, use {}. A copy of this dict
1933 examples start with a clean slate.
1936 merged into the globals that are used to execute examples. By
2026 Test examples in the given object's docstring (`f`), using `globs`
2032 Python compiler when running the examples. If not specified, then
2079 print f, "of", t, "examples failed in string", name
2385 # number of doctest examples in tests is zero (i.e. if no doctest
2386 # examples were found). However, we should probably not be raising
2395 if len(test.examples) == 0:
2523 r"""Extract script from text with examples.
2525 Converts text with examples to a Python script. Example input is
2530 ... Here are examples of simple math.
2555 # Here are examples of simple math.