Permalink
Browse files

Use %r instead of %s in __repr__ to avoid unicode'y returns

Closes #48
  • Loading branch information...
1 parent 70837e6 commit 6cfe04011ac97c8a7b1285dd5a9b3b32f3dbdb6c @dbr committed Apr 6, 2015
Showing with 6 additions and 6 deletions.
  1. +2 −2 tests/test_tvdb_api.py
  2. +4 −4 tvdb_api.py
@@ -217,7 +217,7 @@ def test_repr_show(self):
"""
self.assertEquals(
repr(self.t['CNNNN']),
- "<Show Chaser Non-Stop News Network (CNNNN) (containing 3 seasons)>"
+ "<Show u'Chaser Non-Stop News Network (CNNNN)' (containing 3 seasons)>"
)
def test_repr_season(self):
"""Check repr() of Season
@@ -231,7 +231,7 @@ def test_repr_episode(self):
"""
self.assertEquals(
repr(self.t['CNNNN'][1][1]),
- "<Episode 01x01 - Terror Alert>"
+ "<Episode 01x01 - u'Terror Alert'>"
)
def test_have_all_languages(self):
"""Check valid_languages is up-to-date (compared to languages.xml)
View
@@ -97,7 +97,7 @@ def __init__(self):
self.data = {}
def __repr__(self):
- return "<Show %s (containing %s seasons)>" % (
+ return "<Show %r (containing %s seasons)>" % (
self.data.get(u'seriesname', 'instance'),
len(self)
)
@@ -235,7 +235,7 @@ def __repr__(self):
epno = int(self.get(u'episodenumber', 0))
epname = self.get(u'episodename')
if epname is not None:
- return "<Episode %02dx%02d - %s>" % (seasno, epno, epname)
+ return "<Episode %02dx%02d - %r>" % (seasno, epno, epname)
else:
return "<Episode %02dx%02d>" % (seasno, epno)
@@ -296,7 +296,7 @@ class Actor(dict):
sortorder
"""
def __repr__(self):
- return "<Actor \"%s\">" % (self.get("name"))
+ return "<Actor %r>" % (self.get("name"))
class Tvdb:
@@ -954,7 +954,7 @@ def __getitem__(self, key):
return self.shows[sid]
def __repr__(self):
- return str(self.shows)
+ return repr(self.shows)
def main():

0 comments on commit 6cfe040

Please sign in to comment.