pyment
pyment copied to clipboard
Doctests get placed strangely in numpydoc format
Using the following input, the paragraphs are all placed together with several intervening lines, and the doctests are all placed at the end.
from __future__ import (absolute_import, division, print_function)
import sys
def _event_type_class_factory():
"""
A line that describe this function that does some stuff.
>>> import os
>>> print(os.getcwd())
Another line that is between some things.
>>> import sys
>>> sys.getdefaultencoding()
Another filler line.
>>> print('yes')
"""
pass
Output using 7b4fd871a0f30316149d709e419babfbf7049c74 via pyment -o numpydoc -t -f False test.py
:
from __future__ import (absolute_import, division, print_function)
import sys
def _event_type_class_factory():
"""
A line that describe this function that does some stuff.
Another line that is between some things.
Another filler line.
Parameters
----------
Returns
-------
>>> import os
>>> print(os.getcwd())
>>> import sys
>>> sys.getdefaultencoding()
>>> print('yes')
"""
pass
Hi @QuLogic,
Thanks for reporting your problem. I already had some problems with doctests (see issue 11). Thus I grouped them at the end of the docstring. But seeing your example I guess that was not a so good idea. I think I will add an option to pyment allowing to group the doctest at the end or to let them as is in description. Does this sound good to you ?
Sure, that's possible, if you think the other behaviour is useful.