Show More
@@ -672,8 +672,8 b' class TextDisplayObject(DisplayObject):' | |||||
672 |
|
672 | |||
673 | class Pretty(TextDisplayObject): |
|
673 | class Pretty(TextDisplayObject): | |
674 |
|
674 | |||
675 | def _repr_pretty_(self): |
|
675 | def _repr_pretty_(self, pp, cycle): | |
676 | return self.data |
|
676 | return pp.text(self.data) | |
677 |
|
677 | |||
678 |
|
678 | |||
679 | class HTML(TextDisplayObject): |
|
679 | class HTML(TextDisplayObject): |
@@ -162,6 +162,13 b' def test_display_available():' | |||||
162 | with AssertNotPrints('NameError'): |
|
162 | with AssertNotPrints('NameError'): | |
163 | ip.run_cell('display') |
|
163 | ip.run_cell('display') | |
164 |
|
164 | |||
|
165 | def test_textdisplayobj_pretty_repr(): | |||
|
166 | p = display.Pretty("This is a simple test") | |||
|
167 | nt.assert_equal(repr(p), '<IPython.core.display.Pretty object>') | |||
|
168 | nt.assert_equal(p.data, 'This is a simple test') | |||
|
169 | ||||
|
170 | p._show_mem_addr = True | |||
|
171 | nt.assert_equal(repr(p), object.__repr__(p)) | |||
165 |
|
172 | |||
166 | def test_displayobject_repr(): |
|
173 | def test_displayobject_repr(): | |
167 | h = display.HTML('<br />') |
|
174 | h = display.HTML('<br />') |
General Comments 0
You need to be logged in to leave comments.
Login now