Erotemic / xdoctest

A rewrite of Python's builtin doctest module (with pytest plugin integration) with AST instead of REGEX.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow xdoctest to accept IPython style doctests

Erotemic opened this issue · comments

We could extend our allowed parsing formats to include an IPython-like syntax. For example:

In [4]: with ubelt.Timer('foo'): 
   ...:     _scipy_module() 
   ...:                                                                                                                                

tic('foo')
...toc('foo')=0.0151s

In [5]: with ubelt.Timer('foo'): 
   ...:     _scipy_module() 
   ...:                                                                                                                                

tic('foo')
...toc('foo')=0.0000s

The In [{num:d}]: + ...: formatting should easy enough to parse out given the docstring. Once it is parsed into a doctest_example.Doctest object, there should be no more issues.

Original idea from discussions around networkx/networkx#4295