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


Python lassie.Lassie类代码示例

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


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

示例1: test_str_image

    def test_str_image(self):
        url = 'http://lassie.it/amp/str_image.html'

        l = Lassie()
        data = l.fetch(url)

        self.assertEqual(1, len(data['images']))
开发者ID:michaelhelmick,项目名称:lassie,代码行数:7,代码来源:test_amp.py

示例2: test_bad_json

    def test_bad_json(self):
        url = 'http://lassie.it/amp/bad_json.html'

        l = Lassie()
        data = l.fetch(url)

        self.assertTrue('amp' in data['url'])
开发者ID:michaelhelmick,项目名称:lassie,代码行数:7,代码来源:test_amp.py

示例3: test_list_json

    def test_list_json(self):
        url = 'http://lassie.it/amp/list_json.html'

        l = Lassie()
        data = l.fetch(url)

        self.assertTrue('Pixar' in data['description'])
开发者ID:michaelhelmick,项目名称:lassie,代码行数:7,代码来源:test_amp.py

示例4: test_list_image_empty

    def test_list_image_empty(self):
        url = 'http://lassie.it/amp/list_image_empty.html'

        l = Lassie()
        data = l.fetch(url)

        self.assertEqual(1, len(data['images']))
开发者ID:michaelhelmick,项目名称:lassie,代码行数:7,代码来源:test_amp.py

示例5: test_list_thumbnail_image

    def test_list_thumbnail_image(self):
        url = 'http://lassie.it/amp/list_thumbnail_image.html'

        l = Lassie()
        data = l.fetch(url)

        self.assertEqual(2, len(data['images']))
开发者ID:michaelhelmick,项目名称:lassie,代码行数:7,代码来源:test_amp.py

示例6: test_video_objects

    def test_video_objects(self):
        url = 'http://lassie.it/amp/video_objects.html'

        l = Lassie()
        data = l.fetch(url)

        self.assertEqual(1, len(data['videos']))
开发者ID:michaelhelmick,项目名称:lassie,代码行数:7,代码来源:test_amp.py

示例7: test_no_html_tag

    def test_no_html_tag(self):
        url = 'http://lassie.it/core/no_html_tag.html'

        l = Lassie()
        data = l.fetch(url)

        self.assertTrue('no_html_tag' in data['title'])
开发者ID:mbeacom,项目名称:lassie,代码行数:7,代码来源:test_core.py

示例8: test_bad_url

    def test_bad_url(self):
        url = 'http://lassie.it/youtube/bad_url_123456.json'

        l = Lassie()
        data = l.fetch(url)

        self.assertIsNone(data.get('oembed'))
开发者ID:mbeacom,项目名称:lassie,代码行数:7,代码来源:test_youtube.py

示例9: test_merge_request_kwargs

    def test_merge_request_kwargs(self):
        l = Lassie()
        l.request_opts = {
            'timeout': 3,
        }

        request_kwargs = l.merge_request_kwargs()
        self.assertTrue('timeout' in request_kwargs)
开发者ID:mbeacom,项目名称:lassie,代码行数:8,代码来源:test_core.py

示例10: test_request_opts_default_user_agent

    def test_request_opts_default_user_agent(self):
        l = Lassie()
        l.request_opts = {
            'timeout': 3
        }

        # headers should be set to {} then User-Agent should be added
        self.assertTrue(l.client.headers['User-Agent'] == FAKE_USER_AGENT)
开发者ID:mbeacom,项目名称:lassie,代码行数:8,代码来源:test_core.py

示例11: test_youtube_good

    def test_youtube_good(self):
        url = 'http://lassie.it/youtube/good.json'

        l = Lassie()
        data = l.fetch(url)

        self.assertEqual(len(data['videos']), 1)
        self.assertEqual(len(data['images']), 1)
开发者ID:mbeacom,项目名称:lassie,代码行数:8,代码来源:test_youtube.py

示例12: test_core_class_setting_is_none

    def test_core_class_setting_is_none(self):
        url = "http://lassie.it/core/class_setting_is_none.html"

        # This is a really odd use-case where they'd set the class attr to None, but it might happen so oh wellz.
        l = Lassie()
        l.open_graph = None
        data = l.fetch(url, open_graph=False)

        self.assertEqual(len(data["images"]), 0)
开发者ID:josephmartz,项目名称:lassie,代码行数:9,代码来源:test_core.py

示例13: test_request_opts_no_headers

    def test_request_opts_no_headers(self):
        l = Lassie()
        l.request_opts = {
            'headers': {},
            'timeout': 3
        }

        # headers should be set to {} then User-Agent should be added
        self.assertTrue(l.client.headers != {})
开发者ID:mbeacom,项目名称:lassie,代码行数:9,代码来源:test_core.py

示例14: test_all_properites

    def test_all_properites(self):
        url = 'http://lassie.it/amp/all_properties.html'

        l = Lassie()
        data = l.fetch(url, all_images=True)

        self.assertEqual(len(data['images']), 3)

        title = 'Google Glass Is Dead, Long Live Snapchat Spectacles'
        self.assertEqual(data['title'], title)
开发者ID:michaelhelmick,项目名称:lassie,代码行数:10,代码来源:test_amp.py

示例15: test_bad_image_dimensions

    def test_bad_image_dimensions(self):
        url = "http://lassie.it/core/bad_image_dimensions.html"

        l = Lassie()
        data = l.fetch(url, all_images=True)

        # lassie.utils.convert_to_int will except a TypeError or ValueError and pass (not setting a width/height on the image)
        image = data["images"][0]
        self.assertTrue(not "width" in image)
        self.assertTrue(not "height" in image)
开发者ID:josephmartz,项目名称:lassie,代码行数:10,代码来源:test_core.py


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