diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-20 14:48:02 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2015-03-20 14:48:02 (GMT) |
commit | ee4c0b9dcfb550094cca086a032d44393b5c3642 (patch) | |
tree | c04129c6917ab6ea583c417066b03afb81828552 /Lib/test/test_tokenize.py | |
parent | 000391b7de634635b493b680f14b907d767d8583 (diff) | |
parent | 74a49ac3f5ac3c7a09c691db4888c981a0cb3232 (diff) | |
download | cpython-ee4c0b9dcfb550094cca086a032d44393b5c3642.zip cpython-ee4c0b9dcfb550094cca086a032d44393b5c3642.tar.gz cpython-ee4c0b9dcfb550094cca086a032d44393b5c3642.tar.bz2 |
Issue #23681: Fixed Python 2 to 3 poring bugs.
Indexing bytes retiurns an integer, not bytes.
Diffstat (limited to 'Lib/test/test_tokenize.py')
-rw-r--r-- | Lib/test/test_tokenize.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py index 8f74a06..03f6148 100644 --- a/Lib/test/test_tokenize.py +++ b/Lib/test/test_tokenize.py @@ -1068,7 +1068,7 @@ class TestTokenize(TestCase): encoding = object() encoding_used = None def mock_detect_encoding(readline): - return encoding, ['first', 'second'] + return encoding, [b'first', b'second'] def mock__tokenize(readline, encoding): nonlocal encoding_used @@ -1087,7 +1087,7 @@ class TestTokenize(TestCase): counter += 1 if counter == 5: return b'' - return counter + return str(counter).encode() orig_detect_encoding = tokenize_module.detect_encoding orig__tokenize = tokenize_module._tokenize @@ -1095,7 +1095,8 @@ class TestTokenize(TestCase): tokenize_module._tokenize = mock__tokenize try: results = tokenize(mock_readline) - self.assertEqual(list(results), ['first', 'second', 1, 2, 3, 4]) + self.assertEqual(list(results), + [b'first', b'second', b'1', b'2', b'3', b'4']) finally: tokenize_module.detect_encoding = orig_detect_encoding tokenize_module._tokenize = orig__tokenize |