Show More
@@ -659,8 +659,8 b' class TextDisplayObject(DisplayObject):' | |||||
659 |
|
659 | |||
660 | class Pretty(TextDisplayObject): |
|
660 | class Pretty(TextDisplayObject): | |
661 |
|
661 | |||
662 | def _repr_pretty_(self): |
|
662 | def _repr_pretty_(self, pp, cycle): | |
663 | return self.data |
|
663 | return pp.text(self.data) | |
664 |
|
664 | |||
665 |
|
665 | |||
666 | class HTML(TextDisplayObject): |
|
666 | class HTML(TextDisplayObject): |
@@ -142,6 +142,13 b' def test_display_available():' | |||||
142 | with AssertNotPrints('NameError'): |
|
142 | with AssertNotPrints('NameError'): | |
143 | ip.run_cell('display') |
|
143 | ip.run_cell('display') | |
144 |
|
144 | |||
|
145 | def test_textdisplayobj_pretty_repr(): | |||
|
146 | p = display.Pretty("This is a simple test") | |||
|
147 | nt.assert_equal(repr(p), '<IPython.core.display.Pretty object>') | |||
|
148 | nt.assert_equal(p.data, 'This is a simple test') | |||
|
149 | ||||
|
150 | p._show_mem_addr = True | |||
|
151 | nt.assert_equal(repr(p), object.__repr__(p)) | |||
145 |
|
152 | |||
146 | def test_displayobject_repr(): |
|
153 | def test_displayobject_repr(): | |
147 | h = display.HTML('<br />') |
|
154 | h = display.HTML('<br />') |
General Comments 0
You need to be logged in to leave comments.
Login now