aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2015-12-20 07:07:14 +0600
committerSergey M․ <dstftw@gmail.com>2015-12-20 07:07:14 +0600
commit6b77d52b1f8ca3777284e4164e5363c110aeba66 (patch)
tree367849aa49298bb5d58f1eb8e315cbafe3674ec3 /test
parent9b9c5355e4c0fe6f9028aaa3b1b8beb28a085433 (diff)
[test_utils] Add tests for encode_compat_str
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index e4e8d3825..1c3290d9b 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -22,6 +22,7 @@ from youtube_dl.utils import (
DateRange,
detect_exe_version,
determine_ext,
+ encode_compat_str,
encodeFilename,
escape_rfc3986,
escape_url,
@@ -449,6 +450,10 @@ class TestUtil(unittest.TestCase):
data = urlencode_postdata({'username': 'foo@bar.com', 'password': '1234'})
self.assertTrue(isinstance(data, bytes))
+ def test_encode_compat_str(self):
+ self.assertEqual(encode_compat_str(b'\xd1\x82\xd0\xb5\xd1\x81\xd1\x82', 'utf-8'), 'тест')
+ self.assertEqual(encode_compat_str('тест', 'utf-8'), 'тест')
+
def test_parse_iso8601(self):
self.assertEqual(parse_iso8601('2014-03-23T23:04:26+0100'), 1395612266)
self.assertEqual(parse_iso8601('2014-03-23T22:04:26+0000'), 1395612266)