Ticket #14466: trac_14466-nb.patch

File trac_14466-nb.patch, 963 bytes (added by nbruin, 9 years ago)

include doctest

  • sage/misc/displayhook.py

    # HG changeset patch
    # User Nils Bruin <nbruin@sfu.ca>
    # Date 1367004195 25200
    # Node ID 674680d02c972cdaf5c121ec59985a149ef240a8
    # Parent  e1c0b828a2d1fa494e8c2fda4e39da3c8511885d
    #14466: 
    
    diff --git a/sage/misc/displayhook.py b/sage/misc/displayhook.py
    a b def format_obj(obj): 
    142142        sage: sage.misc.displayhook.format_obj( \
    143143                [matrix([[1], [2]]), matrix([[3], [4]])])
    144144        '[\n[1]  [3]\n[2], [4]\n]'
     145
     146    TESTS:
     147   
     148    In #14466 we override IPython's special printing of ``type`` objects
     149    and revert it to Python's standard string representation::
     150   
     151        sage: shell=sage.misc.interpreter.get_test_shell()
     152        sage: shell.displayhook(type)
     153        <type 'type'>
     154
    145155    """
     156    if isinstance(obj, type):
     157        return repr(obj)
    146158    ascii_art = False
    147159    if isinstance(obj, (tuple, list)) and len(obj) > 0:
    148160        for o in obj: