update tests

This commit is contained in:
j 2011-02-08 12:43:23 +05:30
parent 4305546f8b
commit 3049c0185d
2 changed files with 5 additions and 5 deletions

View file

@ -42,10 +42,10 @@ def find(query, max_results=DEFAULT_MAX_RESULTS, timeout=DEFAULT_TIMEOUT):
Return max_results tuples with title, url, description
>>> find("The Matrix site:imdb.com", 1)[0][0]
u'The Matrix (1999)'
'The Matrix (1999) - IMDb'
>>> find("The Matrix site:imdb.com", 1)[0][1]
u'http://www.imdb.com/title/tt0133093/'
'http://www.imdb.com/title/tt0133093/'
"""
_results = _find(query, timeout=timeout)
results = []
@ -60,10 +60,10 @@ def _find(query, timeout=DEFAULT_TIMEOUT):
Return parsed json results from google ajax api
>>> _find("The Matrix site:imdb.com")[0]['titleNoFormatting']
u'The Matrix (1999)'
'The Matrix (1999) - IMDb'
>>> _find("The Matrix site:imdb.com")[0]['url']
u'http://www.imdb.com/title/tt0133093/'
'http://www.imdb.com/title/tt0133093/'
"""
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=%s' % quote_plus(query)
results = json.loads(ox.cache.readUrl(url, timeout=timeout))['responseData']['results']

View file

@ -309,7 +309,7 @@ def getMovieId(title, director='', year='', timeout=-1):
>>> getMovieId('2 or 3 Things I Know About Her', 'Jean-Luc Godard', '1967')
u'0060304'
>>> getMovieId(u'Histoire(s) du cinema: Le controle de l'univers', 'Jean-Luc Godard')
>>> getMovieId(u"Histoire(s) du cinema: Le controle de l'univers", 'Jean-Luc Godard')
u'0179214'
>>> getMovieId(u"Histoire(s) du cinéma: Le contrôle de l'univers", 'Jean-Luc Godard')