• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(25)  |  Call(22)  |  Derive(0)  |  Import(3)
Test examples in the given object's docstring (`f`), using `globs`
as globals.  Optional argument `name` is used in failure messages.
If the optional argument `verbose` is true, then generate output
even if there are no failures.

`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`.

Optional keyword arg `optionflags` specifies options for the
testing and output.  See the documentation for `testmod` for more
information.

        def run_docstring_examples(f, globs, verbose=False, name="NoName",
                           compileflags=None, optionflags=0):
    """
    Test examples in the given object's docstring (`f`), using `globs`
    as globals.  Optional argument `name` is used in failure messages.
    If the optional argument `verbose` is true, then generate output
    even if there are no failures.

    `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`.

    Optional keyword arg `optionflags` specifies options for the
    testing and output.  See the documentation for `testmod` for more
    information.
    """
    # Find, parse, and run all tests in the given module.
    finder = DocTestFinder(verbose=verbose, recurse=False)
    runner = DocTestRunner(verbose=verbose, optionflags=optionflags)
    for test in finder.find(f, name, globs=globs):
        runner.run(test, compileflags=compileflags)
        


src/b/o/booggie-HEAD/snippets/graph/Powertrain/graph_test.py   booggie(Download)
    print "Graph tests:"
    import graph_test # Maybe the module name can be extracted from __file__
    from sys import stdout
    from doctest import run_docstring_examples
    time1 = clock()
    testFunctions = sorted(f for f in dir(graph_test) if f.startswith("test"))
    for i,fun in enumerate(testFunctions):
        funObject = eval(fun)
 
        # Test the function, with its asserts for working examples:
        funObject()
 
        # Test its docstring, just for the failing examples:
        run_docstring_examples(funObject, globals())

src/b/o/booggie-HEAD/snippets/graph/Docs and other src/graph_test.py   booggie(Download)
    print "Graph tests:"
    import graph_test # Maybe the module name can be extracted from __file__
    from sys import stdout
    from doctest import run_docstring_examples
    time1 = clock()
    testFunctions = sorted(f for f in dir(graph_test) if f.startswith("test"))
    for i,fun in enumerate(testFunctions):
        funObject = eval(fun)
 
        # Test the function, with its asserts for working examples:
        funObject()
 
        # Test its docstring, just for the failing examples:
        run_docstring_examples(funObject, globals())

src/b/o/booggie-HEAD/snippets/graph/graph_test.py   booggie(Download)
    print "Graph tests:"
    import graph_test # Maybe the module name can be extracted from __file__
    from sys import stdout
    from doctest import run_docstring_examples
    time1 = clock()
    testFunctions = sorted(f for f in dir(graph_test) if f.startswith("test"))
    for i,fun in enumerate(testFunctions):
        funObject = eval(fun)
 
        # Test the function, with its asserts for working examples:
        funObject()
 
        # Test its docstring, just for the failing examples:
        run_docstring_examples(funObject, globals())