##// END OF EJS Templates
Merge pull request #1870 from minrk/captureio...
Merge pull request #1870 from minrk/captureio New `%%capture` cell magic captures stdout/err while running a cell. Uses `capture_output()` context manager, moved to utils.io from IPython.parallel testing utilities, where it originated. The caputre objects can be printed as a string, case in which they display the captured stdout, which is also available as `.stdout`. The captured stderr, if any, is in a `.stderr` attribute. A `.show()` method can be called to quickly print both, with stderr being correctly printed to the sys.stderr stream (so the notebook displays it with red highlighting). closes #1863

File last commit:

r2020:f3a106b5
r7411:024e3846 merge
Show More
test_fakemodule.py
17 lines | 468 B | text/x-python | PythonLexer
"""Tests for the FakeModule objects.
"""
import nose.tools as nt
from IPython.core.fakemodule import FakeModule, init_fakemod_dict
# Make a fakemod and check a few properties
def test_mk_fakemod():
fm = FakeModule()
yield nt.assert_true,fm
yield nt.assert_true,lambda : hasattr(fm,'__file__')
def test_mk_fakemod_fromdict():
"""Test making a FakeModule object with initial data"""
fm = FakeModule(dict(hello=True))
nt.assert_true(fm.hello)