(self, channel)
| 28 | class TeeTestCase(unittest.TestCase): |
| 29 | |
| 30 | def tchan(self, channel): |
| 31 | trap = StringIO() |
| 32 | chan = StringIO() |
| 33 | text = 'Hello' |
| 34 | |
| 35 | std_ori = getattr(sys, channel) |
| 36 | setattr(sys, channel, trap) |
| 37 | |
| 38 | tee = Tee(chan, channel=channel) |
| 39 | |
| 40 | print(text, end='', file=chan) |
| 41 | trap_val = trap.getvalue() |
| 42 | nt.assert_equal(chan.getvalue(), text) |
| 43 | |
| 44 | tee.close() |
| 45 | |
| 46 | setattr(sys, channel, std_ori) |
| 47 | assert getattr(sys, channel) == std_ori |
| 48 | |
| 49 | def test(self): |
| 50 | for chan in ['stdout', 'stderr']: |