Show More
@@ -306,4 +306,4 b' class CapturingDisplayHook(object):' | |||||
306 | if result is None: |
|
306 | if result is None: | |
307 | return |
|
307 | return | |
308 | format_dict, md_dict = self.shell.display_formatter.format(result) |
|
308 | format_dict, md_dict = self.shell.display_formatter.format(result) | |
309 |
self.outputs.append( |
|
309 | self.outputs.append({ 'data': format_dict, 'metadata': md_dict }) |
@@ -1,4 +1,7 b'' | |||||
|
1 | import sys | |||
1 | from IPython.testing.tools import AssertPrints, AssertNotPrints |
|
2 | from IPython.testing.tools import AssertPrints, AssertNotPrints | |
|
3 | from IPython.core.displayhook import CapturingDisplayHook | |||
|
4 | from IPython.utils.capture import CapturedIO | |||
2 |
|
5 | |||
3 | ip = get_ipython() |
|
6 | ip = get_ipython() | |
4 |
|
7 | |||
@@ -26,3 +29,11 b' def test_output_quiet():' | |||||
26 |
|
29 | |||
27 | with AssertNotPrints('2'): |
|
30 | with AssertNotPrints('2'): | |
28 | ip.run_cell('1+1;\n#commented_out_function()', store_history=True) |
|
31 | ip.run_cell('1+1;\n#commented_out_function()', store_history=True) | |
|
32 | ||||
|
33 | def test_capture_display_hook_format(): | |||
|
34 | """Tests that the capture display hook conforms to the CapturedIO output format""" | |||
|
35 | hook = CapturingDisplayHook(ip) | |||
|
36 | hook({"foo": "bar"}) | |||
|
37 | captured = CapturedIO(sys.stdout, sys.stderr, hook.outputs) | |||
|
38 | # Should not raise with RichOutput transformation error | |||
|
39 | captured.outputs |
General Comments 0
You need to be logged in to leave comments.
Login now