From ac2429162c2ac786f36d397e52446b08dc2a0e36 2014-01-23 04:22:08 From: Paul Ivanov Date: 2014-01-23 04:22:08 Subject: [PATCH] 3 at last, 3 at last, thank Guido BDFL... we're 3 at last! --- diff --git a/IPython/terminal/tests/test_embed.py b/IPython/terminal/tests/test_embed.py index 4cb878b..bbe007d 100644 --- a/IPython/terminal/tests/test_embed.py +++ b/IPython/terminal/tests/test_embed.py @@ -33,19 +33,22 @@ IPython.embed() print('bye!') """ +_exit = "exit\r".encode('UTF-8') + def test_ipython_embed(): """test that `IPython.embed()` works""" with NamedFileInTemporaryDirectory('file_with_embed.py') as f: - f.write(_sample_embed) + f.write(_sample_embed.encode('UTF-8')) f.flush() # run `python file_with_embed.py` cmd = [sys.executable, f.name] _, out, p = process_handler(cmd, - lambda p: (p.stdin.write("exit\r"), p.communicate()[:], p)) + lambda p: (p.stdin.write(_exit), p.communicate()[:], p)) + std = out[0].decode('UTF-8') nt.assert_equal(p.returncode, 0) - nt.assert_in('3 . 14', out[0]) - nt.assert_in('IPython', out[0]) - nt.assert_in('bye!', out[0]) + nt.assert_in('3 . 14', std) + nt.assert_in('IPython', std) + nt.assert_in('bye!', std)