Show More
@@ -0,0 +1,46 b'' | |||
|
1 | """ | |
|
2 | Module with tests for stdout | |
|
3 | """ | |
|
4 | ||
|
5 | #----------------------------------------------------------------------------- | |
|
6 | # Copyright (c) 2013, the IPython Development Team. | |
|
7 | # | |
|
8 | # Distributed under the terms of the Modified BSD License. | |
|
9 | # | |
|
10 | # The full license is in the file COPYING.txt, distributed with this software. | |
|
11 | #----------------------------------------------------------------------------- | |
|
12 | ||
|
13 | #----------------------------------------------------------------------------- | |
|
14 | # Imports | |
|
15 | #----------------------------------------------------------------------------- | |
|
16 | ||
|
17 | import sys | |
|
18 | from StringIO import StringIO | |
|
19 | ||
|
20 | from ...tests.base import TestsBase | |
|
21 | from ..stdout import StdoutWriter | |
|
22 | ||
|
23 | ||
|
24 | #----------------------------------------------------------------------------- | |
|
25 | # Class | |
|
26 | #----------------------------------------------------------------------------- | |
|
27 | ||
|
28 | class TestStdout(TestsBase): | |
|
29 | """Contains test functions for stdout.py""" | |
|
30 | ||
|
31 | def test_output(self): | |
|
32 | """Test stdout writer output.""" | |
|
33 | ||
|
34 | # Capture the stdout. Remember original. | |
|
35 | stdout = sys.stdout | |
|
36 | stream = StringIO() | |
|
37 | sys.stdout = stream | |
|
38 | ||
|
39 | # Create stdout writer, test output | |
|
40 | writer = StdoutWriter() | |
|
41 | writer.write('a', {'b': 'c'}) | |
|
42 | output = stream.getvalue() | |
|
43 | self.fuzzy_compare(output, 'a') | |
|
44 | ||
|
45 | # Revert stdout | |
|
46 | sys.stdout = stdout No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now