Merge pull request #976 from Anxuiz/test-examples

[GCI] Test examples when running setup.py test
Change coverage_doctest.py implementation

coverage_doctest.py currently uses a parsing based approach
to get list of files in a module(folder) and then parse each
file to find occurances of methods/functions. This has an obvious
flaw that parsing is ambiguous. Hence the plan is to change the
current implementation to reading a module and getting list of
methods/classes/functions/and what not using __import__, __doc__
,inspect.
Modularize code and format output for classes

I have taken the following steps to improve readibility of code:
* Create a new function, _is_skip which can handle if an object
(class/def) should be skipped for consideration.
* Format the output for classes into Missing Docstrings and
Missing Doctests.

The current test for Doctests is as same as before, if we find a
string '>>>' inside the docstring, we say it has a doctest
otherwise not.
Include functions in coverage; modularize printing

Functions have been included in the reporting framework,
though I still have to ensure that functions are skipped properly.
I found the earlier implementation of skip excessive, where ONLY
startswith('_') should suffice.

Printing report has been made another function. In further steps
I will be trying to combine function and class coverage/reporting
because in essence both work simply over __doc__ strings, and their
pruning mechanism looks same.
Use dir() builtin to find members in module; recurse on classes

Using dir() builtin to find out all members of a module. Also,
instead of listing functions and classes separately -- we use
a single loop to check each memeber for which category it belongs
to. Additionally, if it is a class we recurse to find all methods
inside it.

Also, the printing of output has been made prettier to reflect which
class a method belongs to, functions are bare as expected.
Add scoring to modules

Current scheme of scoring includes all members of a module
(function/class/methods) as entities and the amount of coverage
is defined as total documented entities by total entities.
Create helper function to print out headers

Current underlining was erratic. Changed the underline
to the size of text it was underlining. Also created a helper
function to make code cleaner.
Let os.path handle path -> module name conversion

Replacing path separators by dot for coversion to module names
is scary by using regex based search. os.path.split gives a
handy way to recursively stitch parts together. This handles
edge cases such as trailing slashes etc.
Add verbose mode

Verbose mode is enabled, and the default output is non-verbose.
Show original exception if module fails to load
Add indirect doctests

* Indirect doctest support added
* Printing (verbose) includes doctest now
* Fixed minor issues with has_doctest list, though it is not being
used currently
Fix documentation comments
Remove bare except and introduce skip members

Include a list of skip members to skip functions known to
create problems (generally builtins). Also this removes
a bare except, which can catch random events.
1858b: do not expand a Mul
1858b: don't do extra expansion

    no tests fail without this; the full expansion is only
    done with the factor step
1858b: only factor commutative terms

    factoring of noncommutatives fails so this should be avoided
1858b: save factoring until the end
1858b: exit quickly if there is only 1 free symbol

    If the expression is univariate, there is nothing to separate
    (though factoring might change things, this is not the purpose
    of this routine).
1858b: do not factor univariate nonsepar

    Just as the routine need not start when the whole expression is
    univariate, it also does not need to end with factoring if the
    nonseparated terms are univariate.
1858b: separatevars edits