##// END OF EJS Templates
Merge pull request #4542 from ivanov/history-clear...
Merge pull request #4542 from ivanov/history-clear new `ipython history clear` subcommand This new subcommand is equivalent to ipython history trim --HistoryTrim.keep=0, which is now supported (and also has a more convenient --keep alias) This command comes with a fix to bash completion of flags for ipython history subcmd also included is a tiny fix for nbconvert completion that was pointed out by @jakobgager in #4528 also included is a change to our utils.io.ask_yes_no function that allows for specifying the behavior of a KeyboardInterrupt.

File last commit:

r13366:518e26e1
r13694:24e10561 merge
Show More
test_stdout.py
50 lines | 1.4 KiB | text/x-python | PythonLexer
"""
Module with tests for stdout
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
import sys
from ...tests.base import TestsBase
from ..stdout import StdoutWriter
from IPython.utils.py3compat import PY3
if PY3:
from io import StringIO
else:
from StringIO import StringIO
#-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------
class TestStdout(TestsBase):
"""Contains test functions for stdout.py"""
def test_output(self):
"""Test stdout writer output."""
# Capture the stdout. Remember original.
stdout = sys.stdout
stream = StringIO()
sys.stdout = stream
# Create stdout writer, test output
writer = StdoutWriter()
writer.write('a', {'b': 'c'})
output = stream.getvalue()
self.fuzzy_compare(output, 'a')
# Revert stdout
sys.stdout = stdout