Package epydoc :: Package test :: Module util
[hide private]
[frames] | no frames]

Module util

source code

Utility functions used by the regression tests (*.doctest).

Functions [hide private]
    Test Functions
 
buildvaluedoc(s)
This test function takes a string containing the contents of a module.
source code
 
runbuilder(s, attribs='', build=True, exclude='')
This test function takes a string containing the contents of a module.
source code
 
runparser(s, attribs='', show=True, exclude='')
This test function takes a string containing the contents of a module, and writes it to a file, uses `parse_docs` to parse it, and pretty prints the resulting ModuleDoc object.
source code
 
runintrospecter(s, attribs='', introspect=True, exclude='')
This test function takes a string containing the contents of a module.
source code
 
print_warnings()
Register a logger that will print warnings & errors.
source code
 
testencoding(s, introspect=True, parse=True, debug=True)
An end-to-end test for unicode encodings.
source code
    Helper Functions
 
write_pystring_to_tmp_dir(s) source code
 
cleanup_tmp_dir(tmp_dir) source code
 
to_plain(docstring)
Conver a parsed docstring into plain text
source code
 
fun_to_plain(val_doc)
Convert parsed docstrings in text from a RoutineDoc
source code
 
print_docstring_as_html(self, parsed_docstring, *varargs, **kwargs)
Convert the given parsed_docstring to HTML and print it.
source code
 
remove_surrogates(s)
The following is a helper function, used to convert two-character surrogate sequences into single characters.
source code
Function Details [hide private]

buildvaluedoc(s)

source code 
This test function takes a string containing the contents of a module. It writes the string contents to a file, imports the file as a module, and uses build_doc to build documentation, and returns it as a ValueDoc object.

runbuilder(s, attribs='', build=True, exclude='')

source code 
This test function takes a string containing the contents of a module. It writes the string contents to a file, imports the file as a module, and uses build_doc to build documentation, and pretty prints the resulting ModuleDoc object. The attribs argument specifies which attributes of the APIDocs should be displayed. The build argument gives the name of a variable in the module whose documentation should be built, instead of bilding docs for the whole module.

runparser(s, attribs='', show=True, exclude='')

source code 
This test function takes a string containing the contents of a module, and writes it to a file, uses `parse_docs` to parse it, and pretty prints the resulting ModuleDoc object. The `attribs` argument specifies which attributes of the `APIDoc`s should be displayed. The `show` argument, if specifies, gives the name of the object in the module that should be displayed (but the whole module will always be inspected; this just selects what to display).

runintrospecter(s, attribs='', introspect=True, exclude='')

source code 
This test function takes a string containing the contents of a module. It writes the string contents to a file, imports the file as a module, and uses introspect_docs to introspect it, and pretty prints the resulting ModuleDoc object. The attribs argument specifies which attributes of the APIDocs should be displayed. The introspect argument gives the name of a variable in the module whose value should be introspected, instead of introspecting the whole module.

testencoding(s, introspect=True, parse=True, debug=True)

source code 
An end-to-end test for unicode encodings. This function takes a given string, writes it to a python file, and processes that file's documentation. It then generates HTML output from the documentation, extracts all docstrings from the generated HTML output, and displays them. (In order to extract & display all docstrings, it monkey-patches the HMTLwriter.docstring_to_html() method.)

print_docstring_as_html(self, parsed_docstring, *varargs, **kwargs)

source code 
Convert the given parsed_docstring to HTML and print it. Ignore any other arguments. This function is used by testencoding to monkey-patch the HTMLWriter class's docstring_to_html() method.

remove_surrogates(s)

source code 
The following is a helper function, used to convert two-character surrogate sequences into single characters. This is needed because some systems create surrogates but others don't.