aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2016-09-02 22:57:48 +0700
committerSergey M․ <dstftw@gmail.com>2016-09-02 22:57:48 +0700
commit6562d34a8cbdb93de77a8042f7409ebe31e3e3e4 (patch)
treea33232936d6f43086435f04ca626d8df673d3712 /test
parent5e9e3d0f6bf2055c557f360758d6d7eb146edcba (diff)
[utils] Improve mimetype2ext
Diffstat (limited to 'test')
-rw-r--r--test/test_utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py
index d16ea7f77..405c5d351 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -39,6 +39,7 @@ from youtube_dl.utils import (
is_html,
js_to_json,
limit_length,
+ mimetype2ext,
ohdave_rsa_encrypt,
OnDemandPagedList,
orderedSet,
@@ -625,6 +626,14 @@ class TestUtil(unittest.TestCase):
limit_length('foo bar baz asd', 12).startswith('foo bar'))
self.assertTrue('...' in limit_length('foo bar baz asd', 12))
+ def test_mimetype2ext(self):
+ self.assertEqual(mimetype2ext(None), None)
+ self.assertEqual(mimetype2ext('video/x-flv'), 'flv')
+ self.assertEqual(mimetype2ext('application/x-mpegURL'), 'm3u8')
+ self.assertEqual(mimetype2ext('text/vtt'), 'vtt')
+ self.assertEqual(mimetype2ext('text/vtt;charset=utf-8'), 'vtt')
+ self.assertEqual(mimetype2ext('text/html; charset=utf-8'), 'html')
+
def test_parse_codecs(self):
self.assertEqual(parse_codecs(''), {})
self.assertEqual(parse_codecs('avc1.77.30, mp4a.40.2'), {