Package nltk_lite :: Package test :: Module doctest_driver :: Class UpdateRunner
[hide private]
[frames] | no frames]

Class UpdateRunner

source code

doctest.DocTestRunner --+
                        |
                       UpdateRunner

A subclass of `DocTestRunner` that checks the output of each example, and replaces the expected output with the actual output for any examples that fail.

`UpdateRunner` can be used:

However, care must be taken not to update an example's expected output with an incorrect value.

Instance Methods [hide private]
 
__init__(self, verbose=True, mark_updates=True)
Create a new test runner.
source code
 
run(self, test, compileflags=None, out=None, clear_globs=True)
Run the examples in test, and display the results using the writer function out.
source code
 
report_start(self, out, test, example)
Report that the test runner is about to process the given example.
source code
 
report_success(self, out, test, example, got)
Report that the given example ran successfully.
source code
 
report_unexpected_exception(self, out, test, example, exc_info)
Report that the given example raised an unexpected exception.
source code
 
report_failure(self, out, test, example, got)
Report that the given example failed.
source code
 
_report_replacement(self, out, test, example, replacement) source code
 
_header(self, test, example) source code

Inherited from doctest.DocTestRunner: merge, summarize

Inherited from doctest.DocTestRunner (private): _failure_header

Class Variables [hide private]
  DIVIDER = '---------------------------------------------------...
Method Details [hide private]

__init__(self, verbose=True, mark_updates=True)
(Constructor)

source code 

Create a new test runner.

Optional keyword arg checker is the OutputChecker that should be used to compare the expected outputs and actual outputs of doctest examples.

Optional keyword arg 'verbose' prints lots of stuff if true, only failures if false; by default, it's true iff '-v' is in sys.argv.

Optional argument optionflags can be used to control how the test runner compares expected output to actual output, and how it displays failures. See the documentation for testmod for more information.

Overrides: doctest.DocTestRunner.__init__
(inherited documentation)

run(self, test, compileflags=None, out=None, clear_globs=True)

source code 

Run the examples in test, and display the results using the writer function out.

The examples are run in the namespace test.globs. If clear_globs is true (the default), then this namespace will be cleared after the test runs, to help with garbage collection. If you would like to examine the namespace after the test completes, then use clear_globs=False.

compileflags gives the set of flags that should be used by the Python compiler when running the examples. If not specified, then it will default to the set of future-import flags that apply to globs.

The output of each example is checked using DocTestRunner.check_output, and the results are formatted by the DocTestRunner.report_* methods.

Overrides: doctest.DocTestRunner.run
(inherited documentation)

report_start(self, out, test, example)

source code 
Report that the test runner is about to process the given example. (Only displays a message if verbose=True)
Overrides: doctest.DocTestRunner.report_start
(inherited documentation)

report_success(self, out, test, example, got)

source code 
Report that the given example ran successfully. (Only displays a message if verbose=True)
Overrides: doctest.DocTestRunner.report_success
(inherited documentation)

report_unexpected_exception(self, out, test, example, exc_info)

source code 
Report that the given example raised an unexpected exception.
Overrides: doctest.DocTestRunner.report_unexpected_exception
(inherited documentation)

report_failure(self, out, test, example, got)

source code 
Report that the given example failed.
Overrides: doctest.DocTestRunner.report_failure
(inherited documentation)

Class Variable Details [hide private]

DIVIDER

Value:
'---------------------------------------------------------------------\
-'