Show More
@@ -604,10 +604,16 b' def _re_pattern_pprint(obj, p, cycle):' | |||||
604 |
|
604 | |||
605 | def _type_pprint(obj, p, cycle): |
|
605 | def _type_pprint(obj, p, cycle): | |
606 | """The pprint for classes and types.""" |
|
606 | """The pprint for classes and types.""" | |
607 | if obj.__module__ in ('__builtin__', 'exceptions'): |
|
607 | try: | |
|
608 | mod = obj.__module__ | |||
|
609 | except AttributeError: | |||
|
610 | # Heap allocated types might not have the module attribute. | |||
|
611 | return p.text(obj.__name__) | |||
|
612 | ||||
|
613 | if mod in ('__builtin__', 'exceptions'): | |||
608 | name = obj.__name__ |
|
614 | name = obj.__name__ | |
609 | else: |
|
615 | else: | |
610 |
name = |
|
616 | name = mod + '.' + obj.__name__ | |
611 | p.text(name) |
|
617 | p.text(name) | |
612 |
|
618 | |||
613 |
|
619 |
@@ -18,6 +18,7 b' import nose.tools as nt' | |||||
18 |
|
18 | |||
19 | # Our own imports |
|
19 | # Our own imports | |
20 | from IPython.lib import pretty |
|
20 | from IPython.lib import pretty | |
|
21 | from IPython.testing.decorators import skip_without | |||
21 |
|
22 | |||
22 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
23 | # Classes and functions |
|
24 | # Classes and functions | |
@@ -82,3 +83,12 b' def test_callability_checking():' | |||||
82 | expectedoutput = "Dummy1(...)" |
|
83 | expectedoutput = "Dummy1(...)" | |
83 |
|
84 | |||
84 | nt.assert_equal(gotoutput, expectedoutput) |
|
85 | nt.assert_equal(gotoutput, expectedoutput) | |
|
86 | ||||
|
87 | @skip_without('xxlimited') | |||
|
88 | def test_pprint_heap_allocated_type(): | |||
|
89 | """ | |||
|
90 | Test that pprint works for heap allocated types. | |||
|
91 | """ | |||
|
92 | import xxlimited | |||
|
93 | output = pretty.pretty(xxlimited.Null) | |||
|
94 | nt.assert_equal(output, 'xxlimited.Null') |
General Comments 0
You need to be logged in to leave comments.
Login now