X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=test%2Ftest_utils.py;h=501355c74ad9a745bf8788d0f2e2c603f11b39d8;hb=3047121c639428235191ff5f7afbda7ecda38779;hp=ea1ff0547cbb1e9dd081fb6b90243c0269d7d9ef;hpb=0c176d7bde6fedfb2572caf09cbeb07e14c2f5f7;p=youtube-dl diff --git a/test/test_utils.py b/test/test_utils.py index ea1ff0547..501355c74 100644 --- a/test/test_utils.py +++ b/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,13 @@ 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) + self.assertEqual(determine_ext('http://example.com/foo/bar.nonext/?download', None), None) + self.assertEqual(determine_ext('http://example.com/foo/bar/mp4?download', None), None) + self.assertEqual(determine_ext('http://example.com/foo/bar.m3u8//?download'), 'm3u8') + def test_find_xpath_attr(self): testxml = '''