Comment #13 on issue 2252 by [email protected]: activate docstring examples for symarray()
http://code.google.com/p/sympy/issues/detail?id=2252

So I'm trying to use the try: except: else: approach but....

say the test would be something like this:

    ...     import numpy
    ... except ImportError:
    ...     pass
    ... else:
    ...     from sympy import symarray
    ...     symarray('', 3)
    ...
[Some output]

Doctest will only pass if the output specified in the docstrings is the same as the one doctest gets, right? Well if numpy is installed the output would be: "array([_0, _1, _2], dtype=object)", and if numpy isn't installed you get nothing. The pass isn't bubbled up. But it would work if we have something like:

    ...     import numpy
    ... except ImportError:#this function requires numpy to work, fake pass
    ...     print("array([_0, _1, _2], dtype=object)")
    ... else:
    ...     from sympy import symarray
    ...     symarray('', 3)
    ...
    array([_0, _1, _2], dtype=object)

Isn't this too convoluted?

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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-issues?hl=en.

Reply via email to