Show More
@@ -11,8 +11,6 b' from io import StringIO' | |||
|
11 | 11 | from subprocess import Popen, PIPE |
|
12 | 12 | import unittest |
|
13 | 13 | |
|
14 | import nose.tools as nt | |
|
15 | ||
|
16 | 14 | from IPython.utils.io import IOStream, Tee, capture_output |
|
17 | 15 | |
|
18 | 16 | |
@@ -22,7 +20,7 b' def test_tee_simple():' | |||
|
22 | 20 | text = 'Hello' |
|
23 | 21 | tee = Tee(chan, channel='stdout') |
|
24 | 22 | print(text, file=chan) |
|
25 |
|
|
|
23 | assert chan.getvalue() == text + "\n" | |
|
26 | 24 | |
|
27 | 25 | |
|
28 | 26 | class TeeTestCase(unittest.TestCase): |
@@ -39,7 +37,7 b' class TeeTestCase(unittest.TestCase):' | |||
|
39 | 37 | |
|
40 | 38 | print(text, end='', file=chan) |
|
41 | 39 | trap_val = trap.getvalue() |
|
42 |
|
|
|
40 | self.assertEqual(chan.getvalue(), text) | |
|
43 | 41 | |
|
44 | 42 | tee.close() |
|
45 | 43 | |
@@ -82,8 +80,8 b' class TestIOStream(unittest.TestCase):' | |||
|
82 | 80 | """capture_output() context works""" |
|
83 | 81 | |
|
84 | 82 | with capture_output() as io: |
|
85 |
print( |
|
|
86 |
print( |
|
|
87 | ||
|
88 |
|
|
|
89 |
|
|
|
83 | print("hi, stdout") | |
|
84 | print("hi, stderr", file=sys.stderr) | |
|
85 | ||
|
86 | self.assertEqual(io.stdout, "hi, stdout\n") | |
|
87 | self.assertEqual(io.stderr, "hi, stderr\n") |
General Comments 0
You need to be logged in to leave comments.
Login now