MCPcopy Index your code
hub / github.com/bpython/bpython / test_exception

Method test_exception

bpython/test/test_curtsies_coderunner.py:31–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

29 c.run_code()
30
31 def test_exception(self):
32 c = CodeRunner(
33 request_refresh=lambda: self.orig_stdout.flush()
34 or self.orig_stderr.flush()
35 )
36
37 def ctrlc():
38 raise KeyboardInterrupt()
39
40 stdout = FakeOutput(c, lambda x: ctrlc(), None)
41 stderr = FakeOutput(c, lambda *args, **kwargs: None, None)
42 sys.stdout = stdout
43 sys.stderr = stderr
44 c.load_code("1 + 1")
45 c.run_code()
46
47
48class TestFakeOutput(unittest.TestCase):

Callers

nothing calls this directly

Calls 5

load_codeMethod · 0.95
run_codeMethod · 0.95
CodeRunnerClass · 0.90
FakeOutputClass · 0.90
flushMethod · 0.45

Tested by

no test coverage detected