本文整理汇总了Python中pytvdbapi.api.TVDB类的典型用法代码示例。如果您正苦于以下问题:Python TVDB类的具体用法?Python TVDB怎么用?Python TVDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TVDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_iterate_search
def test_iterate_search(self):
"""It should be possible to iterate over a search result"""
api = TVDB("B43FF87DE395DF56")
search = api.search("house", "en")
for s in search:
self.assertEqual(type(s), pytvdbapi.api.Show)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:7,代码来源:test_api.py
示例2: test_get
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)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:7,代码来源:test_api.py
示例3: test_default_order
def test_default_order(self):
"""It should be possible to get an episode using the default sort order"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode(0, "en", "default", True, seriesid=79349, seasonnumber=2, episodenumber=5)
self.assertEqual(ep.absolute_number, 17)
开发者ID:fuzzycode,项目名称:pytvdbapi,代码行数:7,代码来源:test_api.py
示例4: test_episode_id_kwarg
def test_episode_id_kwarg(self):
"""It should be possible to load the episode passing the episode id as a kwarg"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode(0, "en", "id", True, episodeid=308834)
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
开发者ID:fuzzycode,项目名称:pytvdbapi,代码行数:8,代码来源:test_api.py
示例5: test_missing_id
def test_missing_id(self):
"""It should be possible to call get_episode without passing id as positional argument"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode("en", "id", True, episodeid=308834)
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
开发者ID:fuzzycode,项目名称:pytvdbapi,代码行数:8,代码来源:test_api.py
示例6: test_valid_show
def test_valid_show(self):
"""Given correct values, the function should return a valid Episode instance"""
api = TVDB("B43FF87DE395DF56")
# Second episode of dexter
ep = api.get_episode_by_air_date(79349, 'en', datetime.date(2006, 10, 8))
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
开发者ID:fuzzycode,项目名称:pytvdbapi,代码行数:9,代码来源:test_api.py
示例7: test_zap2it_id
def test_zap2it_id(self):
"""It should be possible to load the show using the zap2it id"""
api = TVDB("B43FF87DE395DF56")
show = api.get_series('EP00859795', 'en', 'zap2it')
self.assertEqual(show.seriesid, 79349) # Dexter
show = api.get_series(859795, 'en', 'zap2it')
self.assertEqual(show.seriesid, 79349) # Dexter
开发者ID:fuzzycode,项目名称:pytvdbapi,代码行数:9,代码来源:test_api.py
示例8: test_imdb_id
def test_imdb_id(self):
"""It should be possible to use the imdb id to get the series"""
api = TVDB("B43FF87DE395DF56")
show = api.get_series(773262, 'en', 'imdb')
self.assertEqual(show.seriesid, 79349) # Dexter
show = api.get_series('tt0773262', 'en', 'imdb')
self.assertEqual(show.seriesid, 79349) # Dexter
开发者ID:fuzzycode,项目名称:pytvdbapi,代码行数:9,代码来源:test_api.py
示例9: test_get_series
def test_get_series(self):
"""
It should be possible to use the get_series alias to get a show
given the right show id.
"""
api = TVDB("B43FF87DE395DF56")
show = api.get_series(79349, "en")
self.assertEqual(show.SeriesName, "Dexter")
self.assertEqual(show.id, 79349)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:10,代码来源:test_api.py
示例10: test_get_episode
def test_get_episode(self):
"""
Provided the episode id, you should be able to
get episode instance.
"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode(308834, "en")
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:10,代码来源:test_api.py
示例11: test_get_actors
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)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:10,代码来源:test_actors.py
示例12: test_force_language
def test_force_language(self):
"""
It should be possible to use the "force_lang" keyword when
creating the TVDB instance
"""
api = TVDB("B43FF87DE395DF56", force_lang=True)
search = api.search("dexter", "it")
self.assertEqual(len(search), 2)
开发者ID:toroettg,项目名称:pytvdbapi,代码行数:10,代码来源:test_api.py
示例13: test_no_actors
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)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:10,代码来源:test_actors.py
示例14: test_iterable_actors
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)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:10,代码来源:test_actors.py
示例15: test_invalid_search_index
def test_invalid_search_index(self):
"""Search should raise TVDBIndexError when trying to access an
invalid index
"""
api = TVDB("B43FF87DE395DF56")
search = api.search("dexter", "en")
self.assertRaises(error.TVDBIndexError, search.__getitem__, 2)
self.assertRaises(error.TVDBIndexError, search.__getitem__, 5)
self.assertRaises(error.TVDBIndexError, search.__getitem__, 100)
self.assertRaises(error.TVDBIndexError, search.__getitem__, "foo")
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:11,代码来源:test_api.py
示例16: test_invalid_actor_attribute
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')
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:11,代码来源:test_actors.py
示例17: test_insensitive_attributes
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()))
开发者ID:adamcw,项目名称:pytvdbapi,代码行数:12,代码来源:test_banner.py
示例18: test_attribute_case
def test_attribute_case(self):
"""
When ignore_case is False, all attributes should be case sensitive
"""
api = TVDB("B43FF87DE395DF56", ignore_case=False)
search = api.search("friends", 'en')
# Load and update the show
show = search[0]
show.update()
self.assertRaises(error.TVDBAttributeError, show.__getattr__, "ImDB_id")
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:12,代码来源:test_api.py
示例19: test_actor_representation
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)
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:12,代码来源:test_actors.py
示例20: test_unicode_search
def test_unicode_search(self):
"""
It should be possible to search for shows containing non ascii chars
"""
api = TVDB("B43FF87DE395DF56")
search = api.search("Alarm für cobra 11", "de")
show = search[0]
self.assertEqual(show[1][2].EpisodeName, "Rote Rosen, schwarzer Tod")
search = api.search('3年B組金八先生', "zh")
show = search[0]
self.assertEqual(show[1][1].EpisodeName, "3年B組金八先生")
开发者ID:BenoitZugmeyer,项目名称:pytvdbapi,代码行数:14,代码来源:test_api.py
注:本文中的pytvdbapi.api.TVDB类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论