[YoutubeDL-tests] Fix test_format_limit
We modify the original info_dict now, we must use a copy.
This commit is contained in:
parent
9d8d675e0e
commit
6e899f1dab
@ -68,22 +68,22 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
{u'format_id': u'great', u'url': u'http://example.com/great'},
|
{u'format_id': u'great', u'url': u'http://example.com/great'},
|
||||||
{u'format_id': u'excellent', u'url': u'http://example.com/exc'},
|
{u'format_id': u'excellent', u'url': u'http://example.com/exc'},
|
||||||
]
|
]
|
||||||
info_dict = {
|
info_dict = lambda:{
|
||||||
u'formats': formats, u'extractor': u'test', 'id': 'testvid'}
|
u'formats': formats, u'extractor': u'test', 'id': 'testvid'}
|
||||||
|
|
||||||
ydl = YDL()
|
ydl = YDL()
|
||||||
ydl.process_ie_result(info_dict)
|
ydl.process_ie_result(info_dict())
|
||||||
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')
|
||||||
|
|
||||||
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())
|
||||||
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())
|
||||||
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 @@ class TestFormatSelection(unittest.TestCase):
|
|||||||
|
|
||||||
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())
|
||||||
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')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user