本文整理汇总了Python中pytvdbapi.api.TVDB.get方法的典型用法代码示例。如果您正苦于以下问题:Python TVDB.get方法的具体用法?Python TVDB.get怎么用?Python TVDB.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pytvdbapi.api.TVDB
的用法示例。
在下文中一共展示了TVDB.get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_get(self):
"""Provided the show id, you should be able to get the show object"""
api = TVDB("B43FF87DE395DF56")
show = api.get(79349, "en")
self.assertEqual(show.SeriesName, "Dexter")
self.assertEqual(show.id, 79349)
示例2: test_iterable_actors
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_iterable_actors(self):
"""
It should be possible to iterate over the actor objects
"""
api = TVDB("B43FF87DE395DF56", actors=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
for actor in show.actor_objects:
self.assertEqual(type(actor), Actor)
示例3: test_no_actors
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_no_actors(self):
"""
The Show instance should have an empty actor_objects when the
actor data has not been loaded.
"""
api = TVDB("B43FF87DE395DF56", actors=False)
show = api.get(79349, "en") # Load the series Dexter
show.update()
self.assertEqual(len(show.actor_objects), 0)
示例4: test_get_actors
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_get_actors(self):
"""
The Show instance should have an actor_objects attribute when the
actor data is loaded.
"""
api = TVDB("B43FF87DE395DF56", actors=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
self.assertEqual(hasattr(show, "actor_objects"), True)
示例5: test_invalid_actor_attribute
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_invalid_actor_attribute(self):
"""
Actor instance should raise an exception when accessing an invalid
attribute.
"""
api = TVDB("B43FF87DE395DF56", actors=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
actor = show.actor_objects[0]
self.assertRaises(error.TVDBAttributeError, actor.__getattr__, 'foo')
示例6: test_actor_representation
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_actor_representation(self):
"""
The representation of the actor should be properly formatted.
"""
api = TVDB("B43FF87DE395DF56", actors=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
regexp = re.compile("^<Actor - .*?>$")
for actor in show.actor_objects:
self.assertNotEqual(regexp.match(actor.__repr__()), None)
示例7: test_insensitive_attributes
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_insensitive_attributes(self):
"""If selected, it should be possible to access the attributes in a case insensitive manner."""
api = TVDB("B43FF87DE395DF56", banners=True, ignore_case=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
banner = show.banner_objects[0]
for a in dir(banner):
self.assertTrue(hasattr(banner, a))
self.assertTrue(hasattr(banner, a.lower()))
self.assertTrue(hasattr(banner, a.upper()))
示例8: test_actor_attributes
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def test_actor_attributes(self):
"""
The attributes of the Actors class should be correct
"""
api = TVDB("B43FF87DE395DF56", actors=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
actor = show.actor_objects[0]
self.assertEqual(hasattr(actor, "id"), True)
self.assertEqual(hasattr(actor, "Image"), True)
self.assertEqual(hasattr(actor, "Name"), True)
self.assertEqual(hasattr(actor, "Role"), True)
self.assertEqual(hasattr(actor, "SortOrder"), True)
self.assertEqual(hasattr(actor, "image_url"), True)
self.assertEqual(len(dir(actor)), 6)
示例9: _getShow
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def _getShow(self, _banners=True):
api = TVDB("B43FF87DE395DF56", banners=_banners)
show = api.get(79349, "en") # Load the series Dexter
show.update()
return show
示例10: setUp
# 需要导入模块: from pytvdbapi.api import TVDB [as 别名]
# 或者: from pytvdbapi.api.TVDB import get [as 别名]
def setUp(self):
api = TVDB("B43FF87DE395DF56", actors=True)
self.show = api.get(79349, "en") # Load the series Dexter
self.show.update()