26.04.2011 08:20, smichr пишет:

> can tests involing warnings be put in doctests rather than the test suite?

> I prefer not to see warnings while running tests. Would it be a better
> idea to put these in docstrings? Or perhaps some warnings management
> could be done to change the warnings into exceptions:
> 
>     [ http://docs.python.org/library/warnings.html ]
> 

Hi!

May be it is related with the issue 101 so I asked some questions.

First of all what do you classify as warnings? I run ./bin/doctestand
don't see warnings in master now. The only report with failed and passed
tests.

But if I add in the docstring, e.g. for depricated "block_diag"
procedure (sympy/matrices/matrices.py),

-----------------
def block_diag(matrices):
    """
    Warning: this function is deprecated. See .diag()

    Constructs a block diagonal matrix from a list of square matrices.

    >>> from sympy.matrices.matrices import block_diag
    >>> block_diag([1, 1])

    See also: diag(), eye()
    """
    import warnings
    warnings.warn("block_diag() is deprecated, use diag() instead",
DeprecationWarning)
    return diag(*matrices)
-----------------


then while  I have warning message indeed:

"""
 DeprecationWarning: block_diag() is deprecated, use diag() instead
  warnings.warn("block_diag() is deprecated, use diag() instead",
DeprecationWarning)
"""

Also, could you explain how do you imagine use-case with the warnings in
details: how should it be formed in the docstring (by the some example)?
E.g it may be sufficient to do not shaped at whole in the docstring as
in the above example.

And what is more significant, what should the reaction of ./bin/doctest
be? Or should it be controlled by "-W" option?



-- 
Alexey U.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to