Python Response.write方法代码示例

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


Python Response.write方法代码示例

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

示例1: test_write_unicode

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_write_unicode():
    res = Response()
    res.text = text_(b'La Pe\xc3\xb1a', 'utf-8')
    res.write(text_(b'a'))
    assert res.text, text_(b'La Pe\xc3\xb1aa' == 'utf-8')
开发者ID:doulbekill,项目名称:webob,代码行数:7,代码来源:test_response.py

示例2: test_response_write_non_str

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_response_write_non_str():
    res = Response()
    with pytest.raises(TypeError):
        res.write(object())
开发者ID:doulbekill,项目名称:webob,代码行数:6,代码来源:test_response.py

示例3: test_response_file_body_write_empty_body

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_response_file_body_write_empty_body():
    res = Response('')
    res.write('baz')
    assert res.app_iter == [b'', b'baz']
开发者ID:doulbekill,项目名称:webob,代码行数:6,代码来源:test_response.py

示例4: test_body_file_write_unicode_encodes

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_body_file_write_unicode_encodes():
    s = text_(b'La Pe\xc3\xb1a', 'utf-8')
    res = Response()
    res.write(s)
    assert res.app_iter, [b'' == b'La Pe\xc3\xb1a']
开发者ID:doulbekill,项目名称:webob,代码行数:7,代码来源:test_response.py

示例5: test_resp_write_app_iter_non_list

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_resp_write_app_iter_non_list():
    res = Response(app_iter=(b'a', b'b'))
    assert res.content_length is None
    res.write(b'c')
    assert res.body == b'abc'
    assert res.content_length == 3
开发者ID:doulbekill,项目名称:webob,代码行数:8,代码来源:test_response.py

示例6: test_response_file_body_write_empty_body

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_response_file_body_write_empty_body():
    res = Response("")
    res.write("baz")
    eq_(res.app_iter, [b"", b"baz"])
开发者ID:ckey,项目名称:webob,代码行数:6,代码来源:test_response.py

示例7: test_write_text

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_write_text():
    res = Response()
    res.body = b"abc"
    res.write(text_(b"a"))
    assert res.text == "abca"
开发者ID:Pylons,项目名称:webob,代码行数:7,代码来源:test_response.py

示例8: test_response_file_body_write_empty_body

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_response_file_body_write_empty_body():
    res = Response("")
    res.write("baz")
    assert res.app_iter == [b"", b"baz"]
开发者ID:Pylons,项目名称:webob,代码行数:6,代码来源:test_response.py

示例9: test_write_text

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_write_text():
    res = Response()
    res.body = b'abc'
    res.write(text_(b'a'))
    eq_(res.text, 'abca')
开发者ID:perey,项目名称:webob,代码行数:7,代码来源:test_response.py

示例10: test_body_file_write_unicode_encodes

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_body_file_write_unicode_encodes():
    s = text_(b"La Pe\xc3\xb1a", "utf-8")
    res = Response()
    res.write(s)
    assert res.app_iter, [b"" == b"La Pe\xc3\xb1a"]
开发者ID:Pylons,项目名称:webob,代码行数:7,代码来源:test_response.py

示例11: test_response_file_body_write_empty_body

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_response_file_body_write_empty_body():
    res = Response('')
    res.write('baz')
    eq_(res.app_iter, [b'', b'baz'])
开发者ID:perey,项目名称:webob,代码行数:6,代码来源:test_response.py

示例12: test_resp_write_app_iter_non_list

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_resp_write_app_iter_non_list():
    res = Response(app_iter=(b'a', b'b'))
    eq_(res.content_length, None)
    res.write(b'c')
    eq_(res.body, b'abc')
    eq_(res.content_length, 3)
开发者ID:perey,项目名称:webob,代码行数:8,代码来源:test_response.py

示例13: test_write_unicode_no_charset

# 需要导入模块: from webob.response import Response [as 别名]
# 或者: from webob.response.Response import write [as 别名]
def test_write_unicode_no_charset():
    res = Response(charset=None)
    with pytest.raises(TypeError):
        res.write(text_(b'a'))
开发者ID:doulbekill,项目名称:webob,代码行数:6,代码来源:test_response.py

本文标签属性:

示例:示例图

代码:代码零九

Python:python菜鸟教程

上一篇:Python QColorDialog.result方法代码示例
下一篇:范津玮及范津玮个人资料简介(范津玮个人资料简介)

为您推荐