Commit 76715e2b authored by richardARPANET's avatar richardARPANET

Merge branch 'bugfix434' into 'master'

Bugfix for issue in ``ImdbFacade.get_title`` where with titles which no do yet…

See merge request !9
parents 5cc49477 b73fb280
Pipeline #124 passed with stage
in 17 minutes and 21 seconds
......@@ -6,7 +6,7 @@ Release History
5.6.1 (unreleased)
++++++++++++++++++
- Nothing changed yet.
- Bugfix for issue in ``ImdbFacade.get_title`` where with titles which no do yet have credits information would cause ``KeyError`` to raise.
5.6.0 (2018-06-09)
......
......@@ -140,7 +140,7 @@ class ImdbFacade(object):
def _get_credits(self, credits_data):
credits = []
for category in credits_data['credits']:
for category in credits_data.get('credits', ()):
for item in credits_data['credits'][category]:
credits.append(TitleName(
name=item['name'],
......
......@@ -80,13 +80,16 @@ class TestGetTitle(object):
if num_checked > 5:
break
def test_tv_episode(self, facade):
episode_imdb_id = 'tt4847050'
@pytest.mark.parametrize('episode_imdb_id', [
'tt4847050',
'tt4849022',
])
def test_tv_episode(self, facade, episode_imdb_id):
title = facade.get_title(imdb_id=episode_imdb_id)
assert isinstance(title, Title)
assert isinstance(title.runtime, int)
assert title.runtime > 0
assert isinstance(title.runtime, (int, type(None)))
assert title.imdb_id == episode_imdb_id
assert len(title.episodes) == 0
assert isinstance(title.season, int)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment