Skip to content

Commit

Permalink
Python 3.x compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzeman committed Mar 31, 2015
1 parent 1ab4cd3 commit 0c185b7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 36 deletions.
70 changes: 35 additions & 35 deletions tests/test_search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from tests.core.helpers import read

from six.moves.urllib_parse import urlparse, parse_qsl
from trakt import Trakt
from urlparse import urlparse, parse_qsl
import responses


Expand Down Expand Up @@ -50,7 +50,7 @@ def test_lookup_movie():
assert movie.title == "The Avengers"
assert movie.year == 2012

assert movie.images.keys() == ['fanart', 'poster']
assert sorted(movie.images.keys()) == ['fanart', 'poster']
assert movie.overview is not None
assert movie.score is None

Expand Down Expand Up @@ -79,7 +79,7 @@ def test_lookup_show():
assert show.title == "Breaking Bad"
assert show.year == 2008

assert show.images.keys() == ['fanart', 'poster']
assert sorted(show.images.keys()) == ['fanart', 'poster']
assert show.overview is not None
assert show.score is None

Expand Down Expand Up @@ -107,7 +107,7 @@ def test_lookup_episode():

assert episode.title == "Pilot"

assert episode.images.keys() == ['screenshot']
assert sorted(episode.images.keys()) == ['screenshot']
assert episode.overview is not None
assert episode.score is None

Expand All @@ -119,7 +119,7 @@ def test_lookup_episode():
assert episode.show.title == "Breaking Bad"
assert episode.show.year == 2008

assert episode.show.images.keys() == ['fanart', 'poster']
assert sorted(episode.show.images.keys()) == ['fanart', 'poster']


@responses.activate
Expand All @@ -135,16 +135,16 @@ def test_query_movie():
movies = Trakt['search'].query('The Avengers', 'movie')

assert [(m.score, (m.title, m.year)) for m in movies] == [
(77.052734, (u'Avenged', None)),
(77.0176, (u'Avenger', 2006)),
(60.26589, (u'The Avengers', 2012)),
(60.26589, (u'The Avengers', 1998)),
(60.26589, (u'The Avenger', 1960)),
(60.26589, (u'The Avenger', 1931)),
(60.26589, (u'The Avenging', 1982)),
(60.26589, (u'The Avenger', 1947)),
(55.793285, (u'Invisible Avenger', 1954)),
(55.652233, (u'Crippled Avengers', 1978))
(77.052734, ('Avenged', None)),
(77.0176, ('Avenger', 2006)),
(60.26589, ('The Avengers', 2012)),
(60.26589, ('The Avengers', 1998)),
(60.26589, ('The Avenger', 1960)),
(60.26589, ('The Avenger', 1931)),
(60.26589, ('The Avenging', 1982)),
(60.26589, ('The Avenger', 1947)),
(55.793285, ('Invisible Avenger', 1954)),
(55.652233, ('Crippled Avengers', 1978))
]


Expand All @@ -161,16 +161,16 @@ def test_query_show():
shows = Trakt['search'].query('Breaking Bad', 'show')

assert [(s.score, (s.title, s.year)) for s in shows] == [
(54.809517, (u'Breaking Bad', 2008)),
(28.975079, (u'Breaking Boston', 2014)),
(28.89469, (u'Breaking In', 2011)),
(26.28082, (u'Talking Bad', 2013)),
(20.346865, (u'Donal MacIntyre: Breaking Crime', 2015)),
(18.345793, (u'Good Times, Bad Times', 1990)),
(1.1290063, (u'What About Brian', 2006)),
(0.39297247, (u'It Could Be Worse', 2013)),
(0.39297247, (u'Murder Police', None)),
(0.3438509, (u'Pinocchio', 2014))
(54.809517, ('Breaking Bad', 2008)),
(28.975079, ('Breaking Boston', 2014)),
(28.89469, ('Breaking In', 2011)),
(26.28082, ('Talking Bad', 2013)),
(20.346865, ('Donal MacIntyre: Breaking Crime', 2015)),
(18.345793, ('Good Times, Bad Times', 1990)),
(1.1290063, ('What About Brian', 2006)),
(0.39297247, ('It Could Be Worse', 2013)),
(0.39297247, ('Murder Police', None)),
(0.3438509, ('Pinocchio', 2014))
]


Expand All @@ -187,14 +187,14 @@ def test_query_episode():
episodes = Trakt['search'].query('Breaking Bad', 'episode')

assert [(e.score, (e.pk, e.title), (e.show.title, e.show.year)) for e in episodes] == [
(77.16374, ((2, 13), u'Bad Breaks'), (u'Burn Notice', 2007)),
(77.16374, ((1, 1), u'Breaking Bad'), (u"The Writers' Room", 2013)),
(77.16374, ((2, 18), u'Breaking Bad'), (u'Honest Trailers', 2012)),
(77.16374, ((4, 7), u'Bad Break'), (u'Bad Girls Club', 2006)),
(77.16374, ((1, 8), u'Bad Break'), (u'Miami Ink', 2005)),
(77.16374, ((2, 6), u'Breaking Bad'), (u'Pawn Stars UK', 2013)),
(77.16374, ((6, 16), u'Bad Breaks'), (u'Trapper John, M.D.', 1979)),
(77.16374, ((3, 8), u'Breaking Bad'), (u'Bad Days', 1969)),
(77.16374, ((1, 261), u'Breaking Bad'), (u'The Totally Rad Show', 2007)),
(77.16374, ((1, 2), u' Breaking Bad'), (u'Fight Factory', 2012))
(77.16374, ((2, 13), 'Bad Breaks'), ('Burn Notice', 2007)),
(77.16374, ((1, 1), 'Breaking Bad'), ("The Writers' Room", 2013)),
(77.16374, ((2, 18), 'Breaking Bad'), ('Honest Trailers', 2012)),
(77.16374, ((4, 7), 'Bad Break'), ('Bad Girls Club', 2006)),
(77.16374, ((1, 8), 'Bad Break'), ('Miami Ink', 2005)),
(77.16374, ((2, 6), 'Breaking Bad'), ('Pawn Stars UK', 2013)),
(77.16374, ((6, 16), 'Bad Breaks'), ('Trapper John, M.D.', 1979)),
(77.16374, ((3, 8), 'Breaking Bad'), ('Bad Days', 1969)),
(77.16374, ((1, 261), 'Breaking Bad'), ('The Totally Rad Show', 2007)),
(77.16374, ((1, 2), ' Breaking Bad'), ('Fight Factory', 2012))
]
2 changes: 1 addition & 1 deletion trakt/core/request.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from requests import Request
from urllib import urlencode
from six.moves.urllib_parse import urlencode
import json
import six

Expand Down

0 comments on commit 0c185b7

Please sign in to comment.