|
@@ -1,3 +1,6 @@
|
|
|
+# encoding: utf-8
|
|
|
+from __future__ import unicode_literals
|
|
|
+
|
|
|
from .. import unittest
|
|
|
from compose import utils
|
|
|
|
|
@@ -14,3 +17,16 @@ class JsonSplitterTestCase(unittest.TestCase):
|
|
|
utils.json_splitter(data),
|
|
|
({'foo': 'bar'}, '{"next": "obj"}')
|
|
|
)
|
|
|
+
|
|
|
+
|
|
|
+class StreamAsTextTestCase(unittest.TestCase):
|
|
|
+
|
|
|
+ def test_stream_with_non_utf_unicode_character(self):
|
|
|
+ stream = [b'\xed\xf3\xf3']
|
|
|
+ output, = utils.stream_as_text(stream)
|
|
|
+ assert output == '���'
|
|
|
+
|
|
|
+ def test_stream_with_utf_character(self):
|
|
|
+ stream = ['ěĝ'.encode('utf-8')]
|
|
|
+ output, = utils.stream_as_text(stream)
|
|
|
+ assert output == 'ěĝ'
|