]> jfr.im git - yt-dlp.git/blobdiff - test/test_write_annotations.py
[cleanup] Point all shebang to `python3` (#372)
[yt-dlp.git] / test / test_write_annotations.py
index 780636c7730d396c381fd45fd6d4e8126d1c9fe2..fa31be0cc666cc7017c0adec586687ac6f506bc3 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # coding: utf-8
 from __future__ import unicode_literals
 
 
 import xml.etree.ElementTree
 
-import youtube_dl.YoutubeDL
-import youtube_dl.extractor
+import yt_dlp.YoutubeDL
+import yt_dlp.extractor
 
 
-class YoutubeDL(youtube_dl.YoutubeDL):
+class YoutubeDL(yt_dlp.YoutubeDL):
     def __init__(self, *args, **kwargs):
         super(YoutubeDL, self).__init__(*args, **kwargs)
         self.to_stderr = self.to_screen
 
+
 params = get_params({
     'writeannotations': True,
     'skip_download': True,
@@ -33,7 +34,7 @@ def __init__(self, *args, **kwargs):
 
 
 TEST_ID = 'gr51aVj-mLg'
-ANNOTATIONS_FILE = TEST_ID + '.flv.annotations.xml'
+ANNOTATIONS_FILE = TEST_ID + '.annotations.xml'
 EXPECTED_ANNOTATIONS = ['Speech bubble', 'Note', 'Title', 'Spotlight', 'Label']
 
 
@@ -44,7 +45,7 @@ def setUp(self):
 
     def test_info_json(self):
         expected = list(EXPECTED_ANNOTATIONS)  # Two annotations could have the same text.
-        ie = youtube_dl.extractor.YoutubeIE()
+        ie = yt_dlp.extractor.YoutubeIE()
         ydl = YoutubeDL(params)
         ydl.add_info_extractor(ie)
         ydl.download([TEST_ID])
@@ -66,7 +67,7 @@ def test_info_json(self):
                 textTag = a.find('TEXT')
                 text = textTag.text
                 self.assertTrue(text in expected)  # assertIn only added in python 2.7
-                # remove the first occurance, there could be more than one annotation with the same text
+                # remove the first occurrence, there could be more than one annotation with the same text
                 expected.remove(text)
         # We should have seen (and removed) all the expected annotation texts.
         self.assertEqual(len(expected), 0, 'Not all expected annotations were found.')
@@ -74,5 +75,6 @@ def test_info_json(self):
     def tearDown(self):
         try_rm(ANNOTATIONS_FILE)
 
+
 if __name__ == '__main__':
     unittest.main()