瀏覽代碼

[test_utils] Add tests for determine_ext

Sergey M․ 9 年之前
父節點
當前提交
5035536e3f
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      test/test_utils.py

+ 5 - 0
test/test_utils.py

@@ -21,6 +21,7 @@ from youtube_dl.utils import (
     clean_html,
     DateRange,
     detect_exe_version,
+    determine_ext,
     encodeFilename,
     escape_rfc3986,
     escape_url,
@@ -238,6 +239,10 @@ class TestUtil(unittest.TestCase):
         self.assertEqual(unified_strdate('25-09-2014'), '20140925')
         self.assertEqual(unified_strdate('UNKNOWN DATE FORMAT'), None)
 
+    def test_determine_ext(self):
+        self.assertEqual(determine_ext('http://example.com/foo/bar.mp4/?download'), 'mp4')
+        self.assertEqual(determine_ext('http://example.com/foo/bar/?download', None), None)
+
     def test_find_xpath_attr(self):
         testxml = '''<root>
             <node/>