MCPcopy Index your code
hub / github.com/ipython/ipython / tchan

Method tchan

tests/test_io.py:27–44  ·  view source on GitHub ↗
(self, channel)

Source from the content-addressed store, hash-verified

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

Callers 1

testMethod · 0.95

Calls 2

closeMethod · 0.95
TeeClass · 0.90

Tested by

no test coverage detected