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


Python rss_news_feed_parser.RssNewsFeedParser类代码示例

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


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

示例1: test_get_news_music

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,代码行数:7,代码来源:test_rss_news_feed_parser_no_class.py

示例2: test_parse_content_max_items_2

    def test_parse_content_max_items_2(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.parse_xml_content(xml_input, max_items=2)

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

示例3: test_get_news_max_items_2

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,代码行数:7,代码来源:test_rss_news_feed_parser_no_class.py

示例4: test_get_news_music

    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,代码行数:7,代码来源:test_rss_news_feed_parser.py

示例5: test_get_news_max_items_2

    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,代码行数:7,代码来源:test_rss_news_feed_parser.py

示例6: test_parse_content_max_items_2

def test_parse_content_max_items_2():
    feed_parser = RssNewsFeedParser()

    actual = feed_parser.parse_xml_content(parse_content_input, max_items=2)

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

示例7: test_get_news_music_max_items_1

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,代码行数:7,代码来源:test_rss_news_feed_parser_no_class.py

示例8: test_get_news_max_items_1

    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,代码行数:9,代码来源:test_rss_news_feed_parser.py

示例9: test_parse_content

    def test_parse_content(self):
        feed_reader = RssNewsFeedParser()

        actual = feed_reader.parse_xml_content(xml_input)

        # By using itertools.zip_longest(), assertEquals() will eventually fail
        # if the lists are not the same length
        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

示例10: test_get_news_invalid_news_type

    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,代码行数:11,代码来源:test_rss_news_feed_parser.py

示例11: test_parse_content_items_missing

    def test_parse_content_items_missing(self):
        feed_reader = RssNewsFeedParser()

        minimal_input = "<rss><item></item></rss>"
        minimal_results = [
            {"title": "", "link": "", "date_time": "", "image_thumbnail": "", "image_banner": "", "content": ""}
        ]

        actual_results = feed_reader.parse_xml_content(minimal_input)

        self.assertEquals(minimal_results, actual_results)
开发者ID:mwoinoski,项目名称:crs1906,代码行数:11,代码来源:test_rss_news_feed_parser.py

示例12: test_get_news_music

    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,代码行数:15,代码来源:test_rss_news_feed_parser.py

示例13: test_get_news_music_max_items_1

    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,代码行数:18,代码来源:test_rss_news_feed_parser.py

示例14: test_parse_content_items_missing

def test_parse_content_items_missing():
    feed_reader = RssNewsFeedParser()

    minimal_input = '<rss><item></item></rss>'
    minimal_results = [
        {
            'title': '',
            'link': '',
            'date_time': '',
            'image_thumbnail': '',
            'image_banner': '',
            'content': ''
        }
    ]

    actual_results = feed_reader.parse_xml_content(minimal_input)

    assert minimal_results == actual_results
开发者ID:mwoinoski,项目名称:crs1906,代码行数:18,代码来源:test_rss_news_feed_parser_no_class.py

示例15: test_parse_content_items_missing

    def test_parse_content_items_missing(self):
        """This test case will boost test coverage to 100%"""

        feed_reader = RssNewsFeedParser()

        minimal_input = '<rss><item></item></rss>'
        minimal_results = [
            {
                'title': '',
                'link': '',
                'date_time': '',
                'image_thumbnail': '',
                'image_banner': '',
                'content': ''
            }
        ]

        actual_results = feed_reader.parse_xml_content(minimal_input)

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


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