]> gitweb @ CieloNegro.org - youtube-dl.git/commitdiff
[test_YoutubeDL] Fix test_youtube_format_selection
authorYen Chi Hsuan <yan12125@gmail.com>
Tue, 2 Feb 2016 19:42:37 +0000 (03:42 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Tue, 2 Feb 2016 19:42:37 +0000 (03:42 +0800)
Broken since a6c2c24479e5f4827ceb06f64d855329c0a6f593. Thanks to
@jaimeMF and @anisse for pointing that out

test/test_YoutubeDL.py

index 73910eaece7c0b6f7b4fbd23df30d9b50966710a..88c63010e9321f26c621bcf879c5cec528c51081 100644 (file)
@@ -248,6 +248,17 @@ class TestFormatSelection(unittest.TestCase):
 
         def format_info(f_id):
             info = YoutubeIE._formats[f_id].copy()
+
+            # XXX: In real cases InfoExtractor._parse_mpd() fills up 'acodec'
+            # and 'vcodec', while in tests such information is incomplete since
+            # commit a6c2c24479e5f4827ceb06f64d855329c0a6f593
+            # test_YoutubeDL.test_youtube_format_selection is broken without
+            # this fix
+            if 'acodec' in info and 'vcodec' not in info:
+                info['vcodec'] = 'none'
+            elif 'vcodec' in info and 'acodec' not in info:
+                info['acodec'] = 'none'
+
             info['format_id'] = f_id
             info['url'] = 'url:' + f_id
             return info