(self)
| 251 | self.assertEqual(out.getvalue(), "0.5\n") |
| 252 | |
| 253 | def test_interactive(self): |
| 254 | interp = code.InteractiveInterpreter(locals={}) |
| 255 | with captured_output() as (out, err): |
| 256 | with tempfile.NamedTemporaryFile(mode="w", suffix=".py") as f: |
| 257 | f.write("print(1/2)\n") |
| 258 | f.flush() |
| 259 | args.exec_code(interp, [f.name]) |
| 260 | |
| 261 | repl = create_repl(interp=interp) |
| 262 | repl.push("1 / 2") |
| 263 | |
| 264 | self.assertEqual(out.getvalue(), "0.5\n0.5\n") |
| 265 | |
| 266 | |
| 267 | class TestStdOutErr(TestCase): |
nothing calls this directly
no test coverage detected