Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doctests incorrectly formatted with reST option #11

Closed
dmwelch opened this issue Dec 19, 2014 · 2 comments
Closed

doctests incorrectly formatted with reST option #11

dmwelch opened this issue Dec 19, 2014 · 2 comments

Comments

@dmwelch
Copy link

dmwelch commented Dec 19, 2014

def meaning(subject, answer=False):
    """
    >>> meaning('life', answer=True)
    42
    """

converts to

def meaning(subject, answer=False):
    """>>> meaning('life', answer=True)
    42

    :params subject: 
    ...
    """

which breaks the doctest.

In addition, the reST markup is placed after the doctests, which isn't optimal for Sphinx-generated HTML.

@dadadel
Copy link
Owner

dadadel commented Dec 23, 2014

Hi @dmwelch! Thanks for reporting your problem.

Pyment actually will proceed the docstring in the order of elements when it cannot identify them. As it suppose to have at first a description the doctest is considered as that.
I have to identify doctests to put them at the end of the generated docstring so the reST markups will be put before.

dadadel added a commit that referenced this issue Jun 1, 2015
dadadel added a commit that referenced this issue Jun 1, 2015
@dadadel
Copy link
Owner

dadadel commented Jun 1, 2015

@dmwelch This commit should fix the problem. So the Doctests will systematically be put to the end of the docstring. I think there could still be a problem if some text is between two doctests. The doctests will be extracted but not the indeopendent text that will stay on place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants