...
 
Commits (3)
......@@ -6,7 +6,7 @@ Release History
5.6.3 (unreleased)
++++++++++++++++++
- Nothing changed yet.
- Bugfix for handing of national characters within search methods.
5.6.2 (2018-07-09)
......
......@@ -2,7 +2,8 @@ requests>=0.10,<3.0.0
six>=1.0.0,<2.0.0
wheel==0.30.0
boto==2.48.0
python-dateutil==2.6.1
diskcache==2.9.0
python-dateutil>=2.6.1,<3.0.0
diskcache>=2.9.0,<3.0.0
setuptools>=39.0.1
attrs==18.1.0
attrs>=18.1.0,<19.0.0
trans>=2.1.0,<3.0.0
......@@ -7,6 +7,7 @@ from datetime import date
import tempfile
import logging
from trans import trans
import requests
from six import text_type
from six.moves import http_client as httplib
......@@ -148,8 +149,10 @@ class Imdb(Auth):
response.raise_for_status()
def _suggest_search(self, query):
query_encoded = quote(query)
first_alphanum_char = self._query_first_alpha_num(query)
# translates national characters into similar sounding latin characters
cleaned_query = trans(query)
query_encoded = quote(cleaned_query)
first_alphanum_char = self._query_first_alpha_num(cleaned_query)
path = '/suggests/{0}/{1}.json'.format(
first_alphanum_char, query_encoded
)
......
......@@ -71,22 +71,14 @@ def test_title_exists_non_existant_title(client):
def test_search_for_title_searching_title(client):
results = client.search_for_title('Shawshank redemption')
expected_top_results = [
{
'imdb_id': 'tt0111161',
'title': 'The Shawshank Redemption',
'year': '1994',
'type': 'feature',
},
{
'imdb_id': 'tt5443386',
'title': 'The Shawshank Redemption: Behind the Scenes',
'year': '2004',
'type': 'video',
},
]
expected_result = {
'imdb_id': 'tt0111161',
'title': 'The Shawshank Redemption',
'year': '1994',
'type': 'feature',
}
assert len(results) > 0
assert expected_top_results == results[:2]
assert expected_result in results
def test_search_for_title_returns_no_results_if_name_query(client):
......@@ -106,6 +98,7 @@ def test_search_for_title_returns_no_results_if_name_query(client):
'[REC]³ Genesis (2012)',
'¡Three Amigos! (1986)',
'(Untitled) (2009)',
'Æon Flux(2005)',
])
def test_search_for_title_input_with_special_chars(query, client):
results = client.search_for_title(query)
......@@ -275,7 +268,7 @@ def test_get_title_ratings(client):
resource = client.get_title_ratings(imdb_id)
assert sorted(resource.keys()) == sorted(expected_keys)
assert set(expected_keys).issubset(resource.keys())
def test_get_title_quotes(client):
......@@ -367,13 +360,6 @@ def test_get_title_episodes_raises_imdb_id_is_not_that_of_a_tv_show(client):
13,
[1, 2, 3, 4, 5],
),
# Detective conan
(
dict(imdb_id='tt0131179', offset=0, limit=500, season=45),
18,
18,
list(range(1, 47)),
),
]
)
def test_get_title_episodes_detailed(
......