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


Python Body.readline方法代码示例

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


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

示例1: test_readline_buffer_loaded_with_size

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_buffer_loaded_with_size():
    body = Body(StringIO("abc\ndef"))
    body.read(1)  # load internal buffer
    t.eq(body.readline(2), "bc")
    t.eq(body.readline(2), "\n")
    t.eq(body.readline(2), "de")
    t.eq(body.readline(2), "f")
开发者ID:paparent,项目名称:gunicorn,代码行数:9,代码来源:004-test-http-body.py

示例2: test_readline_buffer_loaded_with_size

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_buffer_loaded_with_size():
    body = Body(BytesIO(b"abc\ndef"))
    body.read(1) # load internal buffer
    t.eq(body.readline(2), b"bc")
    t.eq(body.readline(2), b"\n")
    t.eq(body.readline(2), b"de")
    t.eq(body.readline(2), b"f")
开发者ID:1stvamp,项目名称:gunicorn,代码行数:9,代码来源:test_004-http-body.py

示例3: test_readline_no_new_line

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_no_new_line():
    body = Body(BytesIO(b"abcdef"))
    assert body.readline() == b"abcdef"
    body = Body(BytesIO(b"abcdef"))
    assert body.readline(2) == b"ab"
    assert body.readline(2) == b"cd"
    assert body.readline(2) == b"ef"
开发者ID:BerlinK,项目名称:web,代码行数:9,代码来源:test_http.py

示例4: test_readline_no_new_line

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_no_new_line():
    body = Body(BytesIO(b"abcdef"))
    t.eq(body.readline(), b"abcdef")
    body = Body(BytesIO(b"abcdef"))
    t.eq(body.readline(2), b"ab")
    t.eq(body.readline(2), b"cd")
    t.eq(body.readline(2), b"ef")
开发者ID:1stvamp,项目名称:gunicorn,代码行数:9,代码来源:test_004-http-body.py

示例5: test_readline_no_new_line

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_no_new_line():
    body = Body(StringIO("abcdef"))
    t.eq(body.readline(), "abcdef")
    body = Body(StringIO("abcdef"))
    t.eq(body.readline(2), "ab")
    t.eq(body.readline(2), "cd")
    t.eq(body.readline(2), "ef")
开发者ID:paparent,项目名称:gunicorn,代码行数:9,代码来源:004-test-http-body.py

示例6: test_readline_buffer_loaded_with_size

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_buffer_loaded_with_size():
    body = Body(BytesIO(b"abc\ndef"))
    body.read(1)  # load internal buffer
    assert body.readline(2) == b"bc"
    assert body.readline(2) == b"\n"
    assert body.readline(2) == b"de"
    assert body.readline(2) == b"f"
开发者ID:BerlinK,项目名称:web,代码行数:9,代码来源:test_http.py

示例7: test_readline_buffer_loaded

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_buffer_loaded():
    reader = StringIO("abc\ndef")
    body = Body(reader)
    body.read(1)  # load internal buffer
    reader.write("g\nhi")
    reader.seek(7)
    t.eq(body.readline(), "bc\n")
    t.eq(body.readline(), "defg\n")
    t.eq(body.readline(), "hi")
开发者ID:paparent,项目名称:gunicorn,代码行数:11,代码来源:004-test-http-body.py

示例8: test_readline_buffer_loaded

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_buffer_loaded():
    reader = BytesIO(b"abc\ndef")
    body = Body(reader)
    body.read(1) # load internal buffer
    reader.write(b"g\nhi")
    reader.seek(7)
    assert body.readline() == b"bc\n"
    assert body.readline() == b"defg\n"
    assert body.readline() == b"hi"
开发者ID:BerlinK,项目名称:web,代码行数:11,代码来源:test_http.py

示例9: test_readline_buffer_loaded

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_buffer_loaded():
    reader = BytesIO(b"abc\ndef")
    body = Body(reader)
    body.read(1) # load internal buffer
    reader.write(b"g\nhi")
    reader.seek(7)
    print(reader.getvalue())
    t.eq(body.readline(), b"bc\n")
    t.eq(body.readline(), b"defg\n")
    t.eq(body.readline(), b"hi")
开发者ID:1stvamp,项目名称:gunicorn,代码行数:12,代码来源:test_004-http-body.py

示例10: test_readline_new_line_before_size

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_new_line_before_size():
    body = Body(BytesIO(b"abc\ndef"))
    t.eq(body.readline(4), b"abc\n")
    t.eq(body.readline(), b"def")
开发者ID:1stvamp,项目名称:gunicorn,代码行数:6,代码来源:test_004-http-body.py

示例11: test_readline_new_line_before_size

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_new_line_before_size():
    body = Body(BytesIO(b"abc\ndef"))
    assert body.readline(4) == b"abc\n"
    assert body.readline() == b"def"
开发者ID:BerlinK,项目名称:web,代码行数:6,代码来源:test_http.py

示例12: test_readline_new_line_after_size

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_new_line_after_size():
    body = Body(BytesIO(b"abc\ndef"))
    assert body.readline(2) == b"ab"
    assert body.readline() == b"c\n"
开发者ID:BerlinK,项目名称:web,代码行数:6,代码来源:test_http.py

示例13: assert_readline

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def assert_readline(payload, size, expected):
    body = Body(BytesIO(payload))
    assert body.readline(size) == expected
开发者ID:BerlinK,项目名称:web,代码行数:5,代码来源:test_http.py

示例14: assert_readline

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def assert_readline(payload, size, expected):
    body = Body(StringIO(payload))
    t.eq(body.readline(size), expected)
开发者ID:paparent,项目名称:gunicorn,代码行数:5,代码来源:004-test-http-body.py

示例15: test_readline_new_line_before_size

# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import readline [as 别名]
def test_readline_new_line_before_size():
    body = Body(StringIO("abc\ndef"))
    t.eq(body.readline(4), "abc\n")
    t.eq(body.readline(), "def")
开发者ID:paparent,项目名称:gunicorn,代码行数:6,代码来源:004-test-http-body.py


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