commit: 829476b80a86819c79511f60f4fc25f09ab186b7
parent 1dd70fe330f1ae1aa33856d73c10c259b37b7d4a
Author: Philipp Hagemeister <phihag@phihag.de>
Date: Mon, 25 Aug 2014 17:02:52 +0200
[googlesearch] Move test to extractor
Diffstat:
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/test/test_download.py b/test/test_download.py
@@ -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)
diff --git a/test/test_playlists.py b/test/test_playlists.py
@@ -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)
diff --git a/youtube_dl/extractor/googlesearch.py b/youtube_dl/extractor/googlesearch.py
@@ -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"""