(self)
| 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 | |
| 48 | class TestFakeOutput(unittest.TestCase): |
nothing calls this directly
no test coverage detected