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

Python rss_news_feed_parser.RssNewsFeedParser类代码示例

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

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



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


示例16: 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 = feed_reader.parse_xml_content(minimal_input)

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


示例17: test_get_news_music

def test_get_news_music():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.get_news('music')

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


示例18: test_parse_content_max_items_2

def test_parse_content_max_items_2():
    feed_reader = RssNewsFeedParser()

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

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


示例19: test_parse_content

def test_parse_content():
    feed_reader = RssNewsFeedParser()

    actual = feed_reader.parse_xml_content(xml_input)

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


示例20: test_get_news_max_items_2

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python models.TicketsEventMeta类代码示例发布时间:2022-05-27
下一篇:
Python common.checkParams函数代码示例发布时间: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