I think the problem is not that you are adding the docstring manually
but that you are adding them to instances. The doctest runner only
checks classes and functions for doctests.
However, I was looking through the doctest runner to verify this, and
I found a solution, which is not currently used anywhere in the
codebase. If you define a dictionary at the module level called
__test__ like
__test__ = {'R2': R2.__doc__, ...}
Then the doctest runner will test it. You can doctest any string with
this method. I'm sending in a small patch that fixes a minor semantic
about it, but the method seems to work just fine.
Aaron Meurer
On Fri, May 18, 2012 at 2:01 PM, [email protected]
<[email protected]> wrote:
> Can one run doctests on modified docstrings:
>
> ```
> class ClassWithDocstring(object)
> """Blah Blah and doctests."""
> pass
>
> instance_with_docstring = ClassWithDocstring()
> instance_with_docstring.__doc__ = """Blah blah and other doctests"""
> ```
>
> The doctests in instance_with_docstring.__doc__ are not checked.
>
> The reason I am doing this is that I have a Manifold class but also
> predefined Manifold instances for stuff like R^2 and R^3.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.