[googlesearch] Move test to extractor
authorPhilipp Hagemeister <phihag@phihag.de>
Mon, 25 Aug 2014 15:02:52 +0000 (17:02 +0200)
committerPhilipp Hagemeister <phihag@phihag.de>
Mon, 25 Aug 2014 15:02:52 +0000 (17:02 +0200)
test/test_download.py
test/test_playlists.py
youtube_dl/extractor/googlesearch.py

index c8d4ec2c87c97773d60c52ffb342809b8e2a0ffb..5d24300f1d7448bd2e03cdab0c0c2f33abf336e8 100644 (file)
@@ -142,6 +142,11 @@ def generator(test_case):
                     '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)
index 3f79a7d6a5f7d33ce64750c0f4c3d752547c59dc..21583aeedb8a5b45d4fd46749bd4e6c800f92c4c 100644 (file)
@@ -310,15 +310,6 @@ class TestPlaylists(unittest.TestCase):
         self.assertEqual(result['title'], 'Always/Never: A Little-Seen Movie About Nuclear Command and Control : The New Yorker')
         self.assertEqual(len(result['entries']), 3)
 
-    def test_GoogleSearch(self):
-        dl = FakeYDL()
-        ie = GoogleSearchIE(dl)
-        result = ie.extract('gvsearch15:python language')
-        self.assertIsPlaylist(result)
-        self.assertEqual(result['id'], 'python language')
-        self.assertEqual(result['title'], 'python language')
-        self.assertEqual(len(result['entries']), 15)
-
     def test_generic_rss_feed(self):
         dl = FakeYDL()
         ie = GenericIE(dl)
index 383032d81b1c9bd965be9caee8adefd79547b208..469e1f9357eaf66ef48b3bed6c3d464c48f2b5dc 100644 (file)
@@ -14,6 +14,14 @@ class GoogleSearchIE(SearchInfoExtractor):
     _MAX_RESULTS = 1000
     IE_NAME = 'video.google:search'
     _SEARCH_KEY = 'gvsearch'
+    _TEST = {
+        'url': 'gvsearch15:python language',
+        'info_dict': {
+            'id': 'python language',
+            'title': 'python language',
+        },
+        'playlist_count': 15,
+    }
 
     def _get_n_results(self, query, n):
         """Get a specified number of results for a query"""