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