#14466: issue with type in doctests
---------------------------------+------------------------------------------
   Reporter:  zimmerma           |             Owner:  roed     
       Type:  defect             |            Status:  new      
   Priority:  major              |         Milestone:  sage-5.10
  Component:  doctest framework  |          Keywords:           
Work issues:                     |   Report Upstream:  N/A      
  Reviewers:                     |           Authors:           
  Merged in:                     |      Dependencies:           
   Stopgaps:                     |  
---------------------------------+------------------------------------------
 as mentioned on https://groups.google.com/forum/?hl=fr&fromgroups=#!topic
 /sage-devel/wuwWfhWnbCg, there is an issue with {{{type}}} in doctests.
 When using {{{type}}} in an interactive session we get for example:
 {{{
 ----------------------------------------------------------------------
 | Sage Version 5.8, Release Date: 2013-03-15                         |
 | Type "notebook()" for the browser-based notebook interface.        |
 | Type "help()" for help.                                            |
 ----------------------------------------------------------------------
 sage: type(ZZ)
 sage.rings.integer_ring.IntegerRing_class
 }}}
 However, when we put that in a doctest, we get an error:
 {{{
 tarte% cat /tmp/a.py
 def test():
     """
     EXAMPLE::

         sage: type(ZZ)
         sage.rings.integer_ring.IntegerRing_class
     """
     pass
 tarte% /localdisk/tmp/sage-5.8/sage -t /tmp/a.py
 sage -t  "/tmp/a.py"
 **********************************************************************
 File "/tmp/a.py", line 5:
     sage: type(ZZ)
 Expected:
     sage.rings.integer_ring.IntegerRing_class
 Got:
     <type 'sage.rings.integer_ring.IntegerRing_class'>
 **********************************************************************
 1 items had failures:
    1 of   4 in __main__.example_0
 ***Test Failed*** 1 failures.
 For whitespace errors, see the file
 /users/caramel/zimmerma/.sage//tmp/a_11238.py
          [2.1 s]

 ----------------------------------------------------------------------
 The following tests failed:


         sage -t  "/tmp/a.py"
 Total time for all tests: 2.2 seconds
 }}}
 A workaround is to put {{{print type(...)}}} in the doctest, but this
 prints the form {{{<type 'sage.rings.integer_ring.IntegerRing_class'>}}}
 which is not so nice...

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14466>
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to