Opened 9 years ago

Last modified 9 years ago

#14466 closed defect

issue with type in doctests — at Initial Version

Reported by: zimmerma Owned by: roed
Priority: major Milestone: sage-5.10
Component: doctest framework Keywords:
Cc: SimonKing Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

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...

Change History (0)

Note: See TracTickets for help on using tickets.