1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 09:12:40 +01:00

[YoutubeDL] fix tests (Closes #2036)

This commit is contained in:
Philipp Hagemeister 2013-12-23 13:51:41 +01:00
parent 8958b6916c
commit 8e3e03229e

View File

@ -78,12 +78,12 @@ def test_format_limit(self):
ydl = YDL({'format_limit': 'good'}) ydl = YDL({'format_limit': 'good'})
assert ydl.params['format_limit'] == 'good' assert ydl.params['format_limit'] == 'good'
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded[u'format_id'], u'good') self.assertEqual(downloaded[u'format_id'], u'good')
ydl = YDL({'format_limit': 'great', 'format': 'all'}) ydl = YDL({'format_limit': 'great', 'format': 'all'})
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
self.assertEqual(ydl.downloaded_info_dicts[0][u'format_id'], u'meh') self.assertEqual(ydl.downloaded_info_dicts[0][u'format_id'], u'meh')
self.assertEqual(ydl.downloaded_info_dicts[1][u'format_id'], u'good') self.assertEqual(ydl.downloaded_info_dicts[1][u'format_id'], u'good')
self.assertEqual(ydl.downloaded_info_dicts[2][u'format_id'], u'great') self.assertEqual(ydl.downloaded_info_dicts[2][u'format_id'], u'great')
@ -91,7 +91,7 @@ def test_format_limit(self):
ydl = YDL() ydl = YDL()
ydl.params['format_limit'] = 'excellent' ydl.params['format_limit'] = 'excellent'
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded[u'format_id'], u'excellent') self.assertEqual(downloaded[u'format_id'], u'excellent')
@ -105,27 +105,27 @@ def test_format_selection(self):
info_dict = {u'formats': formats, u'extractor': u'test'} info_dict = {u'formats': formats, u'extractor': u'test'}
ydl = YDL({'format': u'20/47'}) ydl = YDL({'format': u'20/47'})
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], u'47') self.assertEqual(downloaded['format_id'], u'47')
ydl = YDL({'format': u'20/71/worst'}) ydl = YDL({'format': u'20/71/worst'})
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], u'35') self.assertEqual(downloaded['format_id'], u'35')
ydl = YDL() ydl = YDL()
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], u'2') self.assertEqual(downloaded['format_id'], u'2')
ydl = YDL({'format': u'webm/mp4'}) ydl = YDL({'format': u'webm/mp4'})
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], u'47') self.assertEqual(downloaded['format_id'], u'47')
ydl = YDL({'format': u'3gp/40/mp4'}) ydl = YDL({'format': u'3gp/40/mp4'})
ydl.process_ie_result(info_dict) ydl.process_ie_result(info_dict.copy())
downloaded = ydl.downloaded_info_dicts[0] downloaded = ydl.downloaded_info_dicts[0]
self.assertEqual(downloaded['format_id'], u'35') self.assertEqual(downloaded['format_id'], u'35')