summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2020-02-15 03:31:31 +0700
committerSergey M․ <dstftw@gmail.com>2020-02-15 03:37:31 +0700
commit4e9e1e240dea1c37c95ceef5e52c15534d56ca7c (patch)
treec2a9f31962ee0efe29401587b2516f10f2b29e47 /test
parente0abaab29332f22f438617a7c425b1b2ee1c14d5 (diff)
downloadyoutube-dl-4e9e1e240dea1c37c95ceef5e52c15534d56ca7c.tar.gz
youtube-dl-4e9e1e240dea1c37c95ceef5e52c15534d56ca7c.tar.xz
youtube-dl-4e9e1e240dea1c37c95ceef5e52c15534d56ca7c.zip
[test_YoutubeDL] Add tests for #10591 (closes #23873)
Diffstat (limited to 'test')
-rw-r--r--test/test_YoutubeDL.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/test/test_YoutubeDL.py b/test/test_YoutubeDL.py
index 0769e2ed2..1e204e551 100644
--- a/test/test_YoutubeDL.py
+++ b/test/test_YoutubeDL.py
@@ -816,12 +816,15 @@ class TestYoutubeDL(unittest.TestCase):
             'webpage_url': 'http://example.com',
         }
 
-        def get_ids(params):
+        def get_downloaded_info_dicts(params):
             ydl = YDL(params)
             # make a deep copy because the dictionary and nested entries
             # can be modified
             ydl.process_ie_result(copy.deepcopy(playlist))
-            return [int(v['id']) for v in ydl.downloaded_info_dicts]
+            return ydl.downloaded_info_dicts
+
+        def get_ids(params):
+            return [int(v['id']) for v in get_downloaded_info_dicts(params)]
 
         result = get_ids({})
         self.assertEqual(result, [1, 2, 3, 4])
@@ -853,6 +856,22 @@ class TestYoutubeDL(unittest.TestCase):
         result = get_ids({'playlist_items': '2-4,3-4,3'})
         self.assertEqual(result, [2, 3, 4])
 
+        # Tests for https://github.com/ytdl-org/youtube-dl/issues/10591
+        # @{
+        result = get_downloaded_info_dicts({'playlist_items': '2-4,3-4,3'})
+        self.assertEqual(result[0]['playlist_index'], 2)
+        self.assertEqual(result[1]['playlist_index'], 3)
+
+        result = get_downloaded_info_dicts({'playlist_items': '2-4,3-4,3'})
+        self.assertEqual(result[0]['playlist_index'], 2)
+        self.assertEqual(result[1]['playlist_index'], 3)
+        self.assertEqual(result[2]['playlist_index'], 4)
+
+        result = get_downloaded_info_dicts({'playlist_items': '4,2'})
+        self.assertEqual(result[0]['playlist_index'], 4)
+        self.assertEqual(result[1]['playlist_index'], 2)
+        # @}
+
     def test_urlopen_no_file_protocol(self):
         # see https://github.com/ytdl-org/youtube-dl/issues/8227
         ydl = YDL()