[generic] Fix rss under Python 2.x and move test to extractor
[youtube-dl] / test / test_download.py
index c8d4ec2c87c97773d60c52ffb342809b8e2a0ffb..6422ef1197d226e8b7f098e7cb415ef58c187fed 100644 (file)
@@ -7,6 +7,7 @@ import unittest
 sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
 
 from test.helper import (
+    assertGreaterEqual,
     get_params,
     gettestcases,
     expect_info_dict,
@@ -136,12 +137,18 @@ def generator(test_case):
                 self.assertEqual(res_dict['_type'], 'playlist')
                 expect_info_dict(self, test_case.get('info_dict', {}), res_dict)
             if 'playlist_mincount' in test_case:
-                self.assertGreaterEqual(
+                assertGreaterEqual(
+                    self,
                     len(res_dict['entries']),
                     test_case['playlist_mincount'],
                     'Expected at least %d in playlist %s, but got only %d' % (
                         test_case['playlist_mincount'], test_case['url'],
                         len(res_dict['entries'])))
+            if 'playlist_count' in test_case:
+                self.assertEqual(
+                    len(res_dict['entries']),
+                    test_case['playlist_count'],
+                    'Expected at %d in playlist %s, but got %d.')
 
             for tc in test_cases:
                 tc_filename = get_tc_filename(tc)