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


Python Builder.run方法代码示例

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


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

示例1: test_file_continue

# 需要导入模块: from wpull.application.builder import Builder [as 别名]
# 或者: from wpull.application.builder.Builder import run [as 别名]
    def test_file_continue(self):
        arg_parser = AppArgumentParser()
        args = arg_parser.parse_args([self.get_url("/static/my_file.txt"), "--continue", "--debug"])

        filename = os.path.join(self.temp_dir.name, "my_file.txt")

        with open(filename, "wb") as out_file:
            out_file.write(b"START")

        app = Builder(args, unit_test=True).build()
        exit_code = yield from app.run()

        self.assertEqual(0, exit_code)

        with open(filename, "rb") as in_file:
            data = in_file.read()

            self.assertEqual("54388a281352fdb2cfa66009ac0e35dd8916af7c", hashlib.sha1(data).hexdigest())
开发者ID:pombredanne,项目名称:wpull,代码行数:20,代码来源:http_app_test.py

示例2: test_file_continue

# 需要导入模块: from wpull.application.builder import Builder [as 别名]
# 或者: from wpull.application.builder.Builder import run [as 别名]
    def test_file_continue(self):
        arg_parser = AppArgumentParser()
        args = arg_parser.parse_args([self.get_url('/example (copy).txt'),
                                      '--continue', '--debug'])

        filename = os.path.join(self.temp_dir.name, 'example (copy).txt')

        with open(filename, 'wb') as out_file:
            out_file.write(b'The')

        app = Builder(args, unit_test=True).build()
        exit_code = yield from app.run()

        self.assertEqual(0, exit_code)

        with open(filename, 'rb') as in_file:
            data = in_file.read()

            self.assertEqual(
                'The real treasure is in Smaug’s heart 💗.\n'
                    .encode('utf-8'),
                data
            )
开发者ID:Super-Rad,项目名称:wpull,代码行数:25,代码来源:ftp_test.py


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