def test_get_first_line(): rfile = BytesIO(b"foo\r\nbar") assert _get_first_line(rfile) == b"foo" rfile = BytesIO(b"\r\nfoo\r\nbar") assert _get_first_line(rfile) == b"foo" with raises(exceptions.HttpReadDisconnect): rfile = BytesIO(b"") _get_first_line(rfile) with raises(exceptions.HttpReadDisconnect): rfile = Mock() rfile.readline.side_effect = exceptions.TcpDisconnect _get_first_line(rfile)
def test_get_first_line(): rfile = BytesIO(b"foo\r\nbar") assert _get_first_line(rfile) == b"foo" rfile = BytesIO(b"\r\nfoo\r\nbar") assert _get_first_line(rfile) == b"foo" with pytest.raises(exceptions.HttpReadDisconnect): rfile = BytesIO(b"") _get_first_line(rfile) with pytest.raises(exceptions.HttpReadDisconnect): rfile = Mock() rfile.readline.side_effect = exceptions.TcpDisconnect _get_first_line(rfile)