#17419: SageDoctestTextFormatter: remove @warn_format_error
-------------------------------------+------------------------
       Reporter:  jdemeyer           |        Owner:
           Type:  enhancement        |       Status:  new
       Priority:  major              |    Milestone:  sage-6.5
      Component:  doctest framework  |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jeroen Demeyer     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
   Dependencies:                     |     Stopgaps:
-------------------------------------+------------------------

Old description:

> With IPython 3.0.0-dev, there is a doctest failure
> {{{
> **********************************************************************
> File "src/sage/plot/graphics.py", line 2412, in
> sage.plot.graphics.Graphics.?
> Failed example:
>     plot(x, typeset='garbage')
> Expected:
>     doctest:...: FormatterWarning: Exception in text/plain formatter:
>     typeset must be set to one of 'default', 'latex', or 'type1'; got
> 'garbage'.
>     None
> Got:
>     Traceback (most recent call last):
>       File "/usr/local/src/sage-git/local/lib/python2.7/site-
> packages/IPython/core/formatters.py", line 232, in warn_format_error
>         r = method(self, *args, **kwargs)
>       File "/usr/local/src/sage-git/local/lib/python2.7/site-
> packages/sage/repl/display/formatter.py", line 281, in __call__
>         obj._graphics_()      # ignore whether there actually is graphics
>       File "/usr/local/src/sage-git/local/lib/python2.7/site-
> packages/sage/plot/graphics.py", line 872, in _graphics_
>         figsize=figsize, dpi=dpi)
>       File "/usr/local/src/sage-git/local/lib/python2.7/site-
> packages/sage/structure/graphics_file.py", line 268, in
> graphics_from_save
>         save_function(filename, **kwds)
>       File "/usr/local/src/sage-git/local/lib/python2.7/site-
> packages/sage/misc/decorators.py", line 471, in wrapper
>         return func(*args, **kwds)
>       File "/usr/local/src/sage-git/local/lib/python2.7/site-
> packages/sage/plot/graphics.py", line 3048, in save
>         figure = self.matplotlib(**options)
>       File "/usr/local/src/sage-git/local/lib/python2.7/site-
> packages/sage/plot/graphics.py", line 2453, in matplotlib
>         " or 'type1'; got '{}'.".format(typeset))
>     ValueError: typeset must be set to one of 'default', 'latex', or
> 'type1'; got 'garbage'.
>     None
> **********************************************************************
> }}}
>
> I propose to remove the `@warn_format_error` from
> `SageDoctestTextFormatter.__call__`

New description:

 In the IPython 3.0.0-dev command line:
 {{{
 sage: plot(x, typeset='garbage')
 [...]
 ValueError: typeset must be set to one of 'default', 'latex', or 'type1';
 got 'garbage'.
 }}}

 However, in a doctest, this becomes
 {{{
 sage: plot(x, typeset='garbage')
 doctest:...: FormatterWarning: Exception in text/plain formatter:
 typeset must be set to one of 'default', 'latex', or 'type1'; got
 'garbage'.
 None
 }}}

 For consistency, I propose to remove the `@warn_format_error` from
 `SageDoctestTextFormatter.__call__`

--

Comment (by vbraun):

 Is there a ticket for the IPython 3.0 upgrade, or even an upstream
 release?

 IMHO it is a bug if upstream master doesn't catch the exception.

--
Ticket URL: <http://trac.sagemath.org/ticket/17419#comment:11>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to