X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;ds=sidebyside;f=test%2Ftest_youtube_subtitles.py;h=a123e6d72df077efc9228e75a5455d3f80624e00;hb=8f3f1aef0547b29f685068fb8ce97d374aeda421;hp=30f2246dd95e5ec4f68d6e05eb727c528de4dce9;hpb=e3700fc9e44c7820e1c38264c84a315c5f91bb2d;p=youtube-dl diff --git a/test/test_youtube_subtitles.py b/test/test_youtube_subtitles.py index 30f2246dd..a123e6d72 100644 --- a/test/test_youtube_subtitles.py +++ b/test/test_youtube_subtitles.py @@ -12,6 +12,7 @@ sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from youtube_dl.InfoExtractors import YoutubeIE from youtube_dl.utils import * +from youtube_dl import FileDownloader PARAMETERS_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "parameters.json") with io.open(PARAMETERS_FILE, encoding='utf-8') as pf: @@ -24,13 +25,13 @@ proxy_handler = compat_urllib_request.ProxyHandler() opener = compat_urllib_request.build_opener(proxy_handler, cookie_processor, YoutubeDLHandler()) compat_urllib_request.install_opener(opener) -class FakeDownloader(object): +class FakeDownloader(FileDownloader): def __init__(self): self.result = [] self.params = parameters def to_screen(self, s): print(s) - def trouble(self, s): + def trouble(self, s, tb=None): raise Exception(s) def download(self, x): self.result.append(x) @@ -80,7 +81,7 @@ class TestYoutubeSubtitles(unittest.TestCase): IE = YoutubeIE(DL) info_dict = IE.extract('QRS8MkLhQmM') subtitles = info_dict[0]['subtitles'] - self.assertEqual(len(subtitles), 12) + self.assertEqual(len(subtitles), 13) def test_youtube_subtitles_format(self): DL = FakeDownloader() DL.params['writesubtitles'] = True