From a1c42a92dbe147a1157e840d27adeb373c544044 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 29 Aug 2007 03:47:36 +0000 Subject: Make test_cmd_line work with strict str/bytes. --- Lib/test/test_cmd_line.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py index 441df09..7d4f2ab 100644 --- a/Lib/test/test_cmd_line.py +++ b/Lib/test/test_cmd_line.py @@ -35,7 +35,7 @@ class CmdLineTest(unittest.TestCase): def verify_valid_flag(self, cmd_line): data = self.start_python(cmd_line) - self.assertTrue(data == b'' or data.endswith('\n')) + self.assertTrue(data == b'' or data.endswith(b'\n')) self.assertTrue(b'Traceback' not in data) def test_environment(self): @@ -58,7 +58,7 @@ class CmdLineTest(unittest.TestCase): self.assertTrue(b'usage' in self.start_python('-h')) def test_version(self): - version = 'Python %d.%d' % sys.version_info[:2] + version = ('Python %d.%d' % sys.version_info[:2]).encode("ascii") self.assertTrue(self.start_python('-V').startswith(version)) def test_run_module(self): @@ -84,8 +84,8 @@ class CmdLineTest(unittest.TestCase): # Runs the timeit module and checks the __main__ # namespace has been populated appropriately p = _spawn_python('-i', '-m', 'timeit', '-n', '1') - p.stdin.write('Timer\n') - p.stdin.write('exit()\n') + p.stdin.write(b'Timer\n') + p.stdin.write(b'exit()\n') data = _kill_python(p) self.assertTrue(data.find(b'1 loop') != -1) self.assertTrue(data.find(b'__main__.Timer') != -1) -- cgit v0.12