• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python api.TVDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python parser.parse_string函数代码示例发布时间:2022-05-27
下一篇:
Python pytube.YouTube类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap