fix hdl tests

This commit is contained in:
Laura Liberda 2021-02-26 18:39:45 +01:00 committed by Dominika
parent 43b1927fe4
commit 0b4878715c

View file

@ -933,14 +933,14 @@ class TestHaruhiDL(unittest.TestCase):
# Test case for https://github.com/hdl-org/haruhi-dl/issues/27064 # Test case for https://github.com/hdl-org/haruhi-dl/issues/27064
def test_ignoreerrors_for_playlist_with_url_transparent_iterable_entries(self): def test_ignoreerrors_for_playlist_with_url_transparent_iterable_entries(self):
class _YDL(YDL): class _HDL(HDL):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(_YDL, self).__init__(*args, **kwargs) super(_HDL, self).__init__(*args, **kwargs)
def trouble(self, s, tb=None): def trouble(self, s, tb=None):
pass pass
ydl = _YDL({ hdl = _HDL({
'format': 'extra', 'format': 'extra',
'ignoreerrors': True, 'ignoreerrors': True,
}) })
@ -984,15 +984,15 @@ class TestHaruhiDL(unittest.TestCase):
def _real_extract(self, url): def _real_extract(self, url):
return self.playlist_result(self._entries()) return self.playlist_result(self._entries())
ydl.add_info_extractor(VideoIE(ydl)) hdl.add_info_extractor(VideoIE(hdl))
ydl.add_info_extractor(PlaylistIE(ydl)) hdl.add_info_extractor(PlaylistIE(hdl))
info = ydl.extract_info('playlist:') info = hdl.extract_info('playlist:')
entries = info['entries'] entries = info['entries']
self.assertEqual(len(entries), 3) self.assertEqual(len(entries), 3)
self.assertTrue(entries[0] is None) self.assertTrue(entries[0] is None)
self.assertTrue(entries[1] is None) self.assertTrue(entries[1] is None)
self.assertEqual(len(ydl.downloaded_info_dicts), 1) self.assertEqual(len(hdl.downloaded_info_dicts), 1)
downloaded = ydl.downloaded_info_dicts[0] downloaded = hdl.downloaded_info_dicts[0]
self.assertEqual(entries[2], downloaded) self.assertEqual(entries[2], downloaded)
self.assertEqual(downloaded['url'], TEST_URL) self.assertEqual(downloaded['url'], TEST_URL)
self.assertEqual(downloaded['title'], 'Video Transparent 2') self.assertEqual(downloaded['title'], 'Video Transparent 2')