本文整理汇总了Python中gunicorn.http.body.Body.read方法的典型用法代码示例。如果您正苦于以下问题:Python Body.read方法的具体用法?Python Body.read怎么用?Python Body.read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gunicorn.http.body.Body
的用法示例。
在下文中一共展示了Body.read方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_readline_buffer_loaded_with_size
# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import read [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"
示例2: test_readline_buffer_loaded_with_size
# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import read [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")
示例3: test_readline_buffer_loaded_with_size
# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import read [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")
示例4: test_readline_buffer_loaded
# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import read [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"
示例5: test_readline_buffer_loaded
# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import read [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")
示例6: test_readline_buffer_loaded
# 需要导入模块: from gunicorn.http.body import Body [as 别名]
# 或者: from gunicorn.http.body.Body import read [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")