當前位置: 首頁>>代碼示例>>Python>>正文


Python api.TVDB類代碼示例

本文整理匯總了Python中pytvdbapi.api.TVDB的典型用法代碼示例。如果您正苦於以下問題:Python TVDB類的具體用法?Python TVDB怎麽用?Python TVDB使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TVDB類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的pytvdbapi.api.TVDB類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。