+import io
import unittest
from unittest.case import skip
def test_read_tweet(self):
for length in [1, 2, 5, 10, 20, 50]:
- buf = ReadBuffer(six.BytesIO(self.stream), length)
+ buf = ReadBuffer(io.BytesIO(self.stream), length)
self.assertEqual('11\n', buf.read_line())
self.assertEqual('{id:12345}\n', buf.read_len(11))
self.assertEqual('\n', buf.read_line())
return ""
# Create a fake stream
- stream = six.BytesIO(six.b(''))
+ stream = io.BytesIO(six.b(''))
# Mock it's read function so it can't be called too many times
mock_read = MagicMock(side_effect=on_read)
def test_read_unicode_tweet(self):
stream = six.b('11\n{id:12345}\n\n23\n{id:23456, test:"\xe3\x81\x93"}\n\n')
for length in [1, 2, 5, 10, 20, 50]:
- buf = ReadBuffer(six.BytesIO(stream), length)
+ buf = ReadBuffer(io.BytesIO(stream), length)
self.assertEqual('11\n', buf.read_line())
self.assertEqual('{id:12345}\n', buf.read_len(11))
self.assertEqual('\n', buf.read_line())