Ejemplo n.º 1
0
def test_body_get_is_none():
    res = Response()
    res._app_iter = None
    with pytest.raises(TypeError):
        Response(app_iter=iter(['a']), body="somebody")
    with pytest.raises(AttributeError):
        res.__getattribute__('body')
Ejemplo n.º 2
0
def test_text_get_no_charset():
    res = Response(charset=None)
    with pytest.raises(AttributeError):
        res.__getattribute__('text')
Ejemplo n.º 3
0
def test_body_get_is_unicode():
    res = Response(app_iter=(['x'] * 51 + [text_(b'x')]))
    with pytest.raises(TypeError):
        res.__getattribute__('body')
Ejemplo n.º 4
0
def test_body_get_is_unicode_notverylong():
    res = Response(app_iter=(text_(b'foo'),))
    with pytest.raises(TypeError):
        res.__getattribute__('body')
Ejemplo n.º 5
0
def test_body_get_is_unicode():
    res = Response(app_iter=(["x"] * 51 + [text_(b"x")]))
    with pytest.raises(TypeError):
        res.__getattribute__("body")
Ejemplo n.º 6
0
def test_body_get_is_unicode():
    res = Response(app_iter=(["x"] * 51 + [text_(b"x")]))
    with pytest.raises(TypeError):
        res.__getattribute__("body")