test_statusandheaders.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:warcio 作者: webrecorder 项目源码 文件源码
def test_to_str_exclude():
    def exclude(h):
        if h[0].lower() == 'multi-line':
            return None

        return h

    sah = StatusAndHeadersParser(['HTTP/1.0']).parse(StringIO(status_headers_1))
    res = sah.to_str(exclude)

    exp = "\
HTTP/1.0 200 OK\r\n\
Content-Type: ABC\r\n\
Some: Value\r\n\
"
    assert(res == exp)

    assert(sah.to_bytes(exclude) == (exp.encode('latin-1') + b'\r\n'))
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号