forked from robotframework/robotframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_encoding.py
More file actions
34 lines (20 loc) · 827 Bytes
/
test_encoding.py
File metadata and controls
34 lines (20 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import unittest
from robot.utils import IRONPYTHON, PY3
from robot.utils.asserts import assert_equal
from robot.utils.encoding import console_decode, CONSOLE_ENCODING
UNICODE = u'hyv\xe4'
ENCODED = UNICODE.encode(CONSOLE_ENCODING)
class TestDecodeOutput(unittest.TestCase):
def test_return_unicode_as_is_by_default(self):
assert_equal(console_decode(UNICODE), UNICODE)
if not IRONPYTHON:
def test_decode(self):
assert_equal(console_decode(ENCODED), UNICODE)
else:
assert isinstance(ENCODED, unicode)
def test_force_decoding(self):
assert_equal(console_decode(ENCODED, force=True), UNICODE)
def test_bytes_are_decoded(self):
assert_equal(console_decode(bytes(ENCODED)), UNICODE)
if __name__ == '__main__':
unittest.main()