aboutsummaryrefslogtreecommitdiff
path: root/test/test_YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-22 14:47:29 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-22 14:47:29 +0100
commitba7678f9cc1099313f3fa9221538116a24e8e627 (patch)
treee1e6d6d3ba3e72e7870392d857f102236a0ab5e2 /test/test_YoutubeDL.py
parenta70c83768e30c99479af04c7cb229545743a9134 (diff)
downloadyoutube-dl-ba7678f9cc1099313f3fa9221538116a24e8e627.tar.xz
Add -f bestaudio (Fixes #2163)
Diffstat (limited to 'test/test_YoutubeDL.py')
-rw-r--r--test/test_YoutubeDL.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 01de10e31..3adb9f344 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -150,6 +150,36 @@ class TestFormatSelection(unittest.TestCase):
downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], u'35')
+ def test_format_selection_audio(self):
+ formats = [
+ {u'format_id': u'audio-low', u'ext': u'webm', 'preference': 1, 'vcodec': 'none'},
+ {u'format_id': u'audio-mid', u'ext': u'webm', 'preference': 2, 'vcodec': 'none'},
+ {u'format_id': u'audio-high', u'ext': u'flv', 'preference': 3, 'vcodec': 'none'},
+ {u'format_id': u'vid', u'ext': u'mp4', 'preference': 4},
+ ]
+ info_dict = {u'formats': formats, u'extractor': u'test'}
+
+ ydl = YDL({'format': u'bestaudio'})
+ ydl.process_ie_result(info_dict.copy())
+ downloaded = ydl.downloaded_info_dicts[0]
+ self.assertEqual(downloaded['format_id'], u'audio-high')
+
+ ydl = YDL({'format': u'worstaudio'})
+ ydl.process_ie_result(info_dict.copy())
+ downloaded = ydl.downloaded_info_dicts[0]
+ self.assertEqual(downloaded['format_id'], u'audio-low')
+
+ formats = [
+ {u'format_id': u'vid-low', u'ext': u'mp4', 'preference': 1},
+ {u'format_id': u'vid-high', u'ext': u'mp4', 'preference': 2},
+ ]
+ info_dict = {u'formats': formats, u'extractor': u'test'}
+
+ ydl = YDL({'format': u'bestaudio/worstaudio/best'})
+ ydl.process_ie_result(info_dict.copy())
+ downloaded = ydl.downloaded_info_dicts[0]
+ self.assertEqual(downloaded['format_id'], u'vid-high')
+
def test_youtube_format_selection(self):
order = [
'38', '37', '46', '22', '45', '35', '44', '18', '34', '43', '6', '5', '36', '17', '13',