Orbits  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
setuptools.tests.doctest.DocTestFinder Class Reference

Public Member Functions

def __init__
 
def find
 

Private Member Functions

def _filter
 
def _from_module
 
def _find
 
def _get_test
 
def _find_lineno
 

Private Attributes

 _parser
 
 _verbose
 
 _recurse
 
 _exclude_empty
 
 _namefilter
 

Detailed Description

  1. DocTest Finder
    A class used to extract the DocTests that are relevant to a given
    object, from its docstring and the docstrings of its contained
    objects.  Doctests can currently be extracted from the following
    object types: modules, functions, classes, methods, staticmethods,
    classmethods, and properties.
    

Constructor & Destructor Documentation

def setuptools.tests.doctest.DocTestFinder.__init__ (   self,
  verbose = False,
  parser = DocTestParser(),
  recurse = True,
  _namefilter = None,
  exclude_empty = True 
)
Create a new doctest finder.

The optional argument `parser` specifies a class or
function that should be used to create new DocTest objects (or
objects that implement the same interface as DocTest).  The
signature for this factory function should match the signature
of the DocTest constructor.

If the optional argument `recurse` is false, then `find` will
only examine the given object, and not any contained objects.

If the optional argument `exclude_empty` is false, then `find`
will include tests for objects with empty docstrings.

Member Function Documentation

def setuptools.tests.doctest.DocTestFinder._filter (   self,
  obj,
  prefix,
  base 
)
private
Return true if the given object should not be examined.
def setuptools.tests.doctest.DocTestFinder._find (   self,
  tests,
  obj,
  name,
  module,
  source_lines,
  globs,
  seen 
)
private
Find tests for the given object and any contained objects, and
add them to `tests`.
def setuptools.tests.doctest.DocTestFinder._find_lineno (   self,
  obj,
  source_lines 
)
private
Return a line number of the given object's docstring.  Note:
this method assumes that the object has a docstring.
def setuptools.tests.doctest.DocTestFinder._from_module (   self,
  module,
  object 
)
private
Return true if the given object is defined in the given
module.
def setuptools.tests.doctest.DocTestFinder._get_test (   self,
  obj,
  name,
  module,
  globs,
  source_lines 
)
private
Return a DocTest for the given object, if it defines a docstring;
otherwise, return None.
def setuptools.tests.doctest.DocTestFinder.find (   self,
  obj,
  name = None,
  module = None,
  globs = None,
  extraglobs = None 
)
Return a list of the DocTests that are defined by the given
object's docstring, or by any of its contained objects'
docstrings.

The optional parameter `module` is the module that contains
the given object.  If the module is not specified or is None, then
the test finder will attempt to automatically determine the
correct module.  The object's module is used:

    - As a default namespace, if `globs` is not specified.
    - To prevent the DocTestFinder from extracting DocTests
      from objects that are imported from other modules.
    - To find the name of the file containing the object.
    - To help find the line number of the object within its
      file.

Contained objects whose module does not match `module` are ignored.

If `module` is False, no attempt to find the module will be made.
This is obscure, of use mostly in tests:  if `module` is False, or
is None but cannot be found automatically, then all objects are
considered to belong to the (non-existent) module, so all contained
objects will (recursively) be searched for doctests.

The globals for each DocTest is formed by combining `globs`
and `extraglobs` (bindings in `extraglobs` override bindings
in `globs`).  A new copy of the globals dictionary is created
for each DocTest.  If `globs` is not specified, then it
defaults to the module's `__dict__`, if specified, or {}
otherwise.  If `extraglobs` is not specified, then it defaults
to {}.

Member Data Documentation

setuptools.tests.doctest.DocTestFinder._exclude_empty
private
setuptools.tests.doctest.DocTestFinder._namefilter
private
setuptools.tests.doctest.DocTestFinder._parser
private
setuptools.tests.doctest.DocTestFinder._recurse
private
setuptools.tests.doctest.DocTestFinder._verbose
private

The documentation for this class was generated from the following file:

Copyright 2014 Google Inc. All rights reserved.