]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[test_compat] Add tests for compat_urllib_parse_urlencode
authorSergey M․ <dstftw@gmail.com>
Fri, 25 Mar 2016 20:38:33 +0000 (02:38 +0600)
committerSergey M․ <dstftw@gmail.com>
Fri, 25 Mar 2016 20:38:33 +0000 (02:38 +0600)
test/test_compat.py

index b6bfad05e3c85c07854cc00c337a12caf493e849..cc105807a3faf0c4a686534cacfaf1d6300f7eb8 100644 (file)
@@ -19,6 +19,7 @@ from youtube_dl.compat import (
     compat_str,
     compat_urllib_parse_unquote,
     compat_urllib_parse_unquote_plus,
+    compat_urllib_parse_urlencode,
 )
 
 
@@ -70,6 +71,12 @@ class TestCompat(unittest.TestCase):
         self.assertEqual(compat_urllib_parse_unquote_plus('abc%20def'), 'abc def')
         self.assertEqual(compat_urllib_parse_unquote_plus('%7e/abc+def'), '~/abc def')
 
+    def test_compat_urllib_parse_urlencode(self):
+        self.assertEqual(compat_urllib_parse_urlencode({'abc': 'def'}), 'abc=def')
+        self.assertEqual(compat_urllib_parse_urlencode({'abc': b'def'}), 'abc=def')
+        self.assertEqual(compat_urllib_parse_urlencode({b'abc': 'def'}), 'abc=def')
+        self.assertEqual(compat_urllib_parse_urlencode({b'abc': b'def'}), 'abc=def')
+
     def test_compat_shlex_split(self):
         self.assertEqual(compat_shlex_split('-option "one two"'), ['-option', 'one two'])