当前位置: 首页>>代码示例>>Python>>正文


Python RssNewsFeedParser.get_news方法代码示例

本文整理汇总了Python中ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser.get_news方法的典型用法代码示例。如果您正苦于以下问题:Python RssNewsFeedParser.get_news方法的具体用法?Python RssNewsFeedParser.get_news怎么用?Python RssNewsFeedParser.get_news使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser的用法示例。


在下文中一共展示了RssNewsFeedParser.get_news方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_news_invalid_news_type

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_invalid_news_type(self):
        # TODO: in the test_get_news_invalid_news_type method, create an
        # instance of RssNewsFeedParser and save a reference to it in a
        # local variable.
        feed_reader = RssNewsFeedParser()

        # TODO: Call an assert method to verify that if you call the
        # feed reader's get_news() method with an invalid news type argument
        # (for example, 'pluto'), the method raises a FeedReaderException.
        with self.assertRaises(FeedReaderException):
            feed_reader.get_news('pluto')
开发者ID:mwoinoski,项目名称:crs1906,代码行数:13,代码来源:test_rss_news_feed_parser.py

示例2: test_get_news_music_max_items_1

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
def test_get_news_music_max_items_1():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music', max_items=1)

    assert 1 == len(actual)
    assert expected[0] == actual[0]
开发者ID:mwoinoski,项目名称:crs1906,代码行数:9,代码来源:test_rss_news_feed_parser_no_class.py

示例3: test_get_news_max_items_2

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_max_items_2(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music', max_items=2)

        for expected_result, actual_result in zip_longest(expected[:2], actual):
            self.assertEquals(expected_result, actual_result)
开发者ID:mwoinoski,项目名称:crs1906,代码行数:9,代码来源:test_rss_news_feed_parser.py

示例4: test_get_news_music

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_music(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        for expected_result, actual_result in zip_longest(expected, actual):
            self.assertEquals(expected_result, actual_result)
开发者ID:mwoinoski,项目名称:crs1906,代码行数:9,代码来源:test_rss_news_feed_parser.py

示例5: test_get_news_max_items_2

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
def test_get_news_max_items_2():
    feed_parser = RssNewsFeedParser()

    actual = feed_parser.get_news('music', max_items=2)

    for expected_result, actual_result in zip_longest(expected[:2], actual):
        assert expected_result == actual_result
开发者ID:mwoinoski,项目名称:crs1906,代码行数:9,代码来源:test_rss_news_feed_parser_no_class.py

示例6: test_get_news_music

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
def test_get_news_music():
    feed_parser = RssNewsFeedParser()

    actual = feed_parser.get_news('music')

    for expected_result, actual_result in zip_longest(expected, actual):
        assert expected_result == actual_result
开发者ID:mwoinoski,项目名称:crs1906,代码行数:9,代码来源:test_rss_news_feed_parser_no_class.py

示例7: test_get_news_max_items_1

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_max_items_1(self):
        feed_reader = RssNewsFeedParser()

        # Note the call FeedReader.get_news() with a max_items argument
        actual = feed_reader.get_news('music', max_items=1)

        # Note the use of list slicing in the following assertion to verify
        # that the actual returned list contains only one item.
        self.assertEqual(expected[:1], actual)
开发者ID:mwoinoski,项目名称:crs1906,代码行数:11,代码来源:test_rss_news_feed_parser.py

示例8: test_get_news_music

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_music(self):
        # TODO: in the test_get_news_music method, create an instance of
        # RssNewsFeedParser and save a reference to it in a local variable
        feed_reader = RssNewsFeedParser()

        # TODO:
        # 1. call the feed reader's get_news() method, passing 'music' as the
        #    argument
        # 2. save the list returned by the method in a local variable
        #    named `actual`
        actual = feed_reader.get_news('music')

        # TODO: call a method that asserts the list named `expected` is
        # equal to the list named `actual`
        self.assertEqual(expected, actual)
开发者ID:mwoinoski,项目名称:crs1906,代码行数:17,代码来源:test_rss_news_feed_parser.py

示例9: test_get_news_music_max_items_1

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_music_max_items_1(self):
        # TODO: in the test_get_news_music_max_items_1 method, create an
        # instance of RssNewsFeedParser and save a reference to it in a
        # local variable.
        feed_reader = RssNewsFeedParser()

        # TODO:
        # 1. call the feed reader's get_news() method, passing
        #    news_type='music' and max_items=1 as the arguments.
        # 2. save the list returned by the method in a local variable
        actual = feed_reader.get_news('music', max_items=1)

        # TODO: call a method that asserts the returned list has length 1
        self.assertEqual(1, len(actual))

        # TODO: verify that the first item of the `expected` list equals the 
        # first item of the returned list.
        self.assertEqual(expected[0], actual[0])
开发者ID:mwoinoski,项目名称:crs1906,代码行数:20,代码来源:test_rss_news_feed_parser.py

示例10: test_get_news_music

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
def test_get_news_music():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music')

    assert expected == actual
开发者ID:mwoinoski,项目名称:crs1906,代码行数:8,代码来源:test_rss_news_feed_parser_no_class.py

示例11: test_get_news_max_items_2

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
def test_get_news_max_items_2():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music', max_items=2)

    assert expected[:2] == actual
开发者ID:mwoinoski,项目名称:crs1906,代码行数:8,代码来源:test_rss_news_feed_parser_no_class.py

示例12: test_get_news_invalid_news_type

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
def test_get_news_invalid_news_type():
    feed_reader = RssNewsFeedParser()

    feed_reader.get_news('pluto')
开发者ID:mwoinoski,项目名称:crs1906,代码行数:6,代码来源:test_rss_news_feed_parser_no_class.py

示例13: test_get_news_invalid_news_type

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
 def test_get_news_invalid_news_type(self):
     feed_reader = RssNewsFeedParser()
     with self.assertRaises(FeedReaderException):
         feed_reader.get_news('pluto')
开发者ID:mwoinoski,项目名称:crs1906,代码行数:6,代码来源:test_rss_news_feed_parser.py

示例14: test_get_news_max_items_2

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_max_items_2(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music', max_items=2)

        self.assertEqual(expected[:2], actual)
开发者ID:mwoinoski,项目名称:crs1906,代码行数:8,代码来源:test_rss_news_feed_parser.py

示例15: test_get_news_music_zip_longest

# 需要导入模块: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser import RssNewsFeedParser [as 别名]
# 或者: from ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser import get_news [as 别名]
    def test_get_news_music_zip_longest(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.get_news('music')

        self.assertEqual(expected, actual)
开发者ID:mwoinoski,项目名称:crs1906,代码行数:8,代码来源:test_rss_news_feed_parser.py


注:本文中的ticketmanor.rest_services.feed_reader.rss_news_feed_parser.RssNewsFeedParser.get_news方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。