Пример #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')
Пример #2
0
def test_text_get_no_charset():
    res = Response(charset=None)
    with pytest.raises(AttributeError):
        res.__getattribute__('text')
Пример #3
0
def test_body_get_is_unicode():
    res = Response(app_iter=(['x'] * 51 + [text_(b'x')]))
    with pytest.raises(TypeError):
        res.__getattribute__('body')
Пример #4
0
def test_body_get_is_unicode_notverylong():
    res = Response(app_iter=(text_(b'foo'),))
    with pytest.raises(TypeError):
        res.__getattribute__('body')
Пример #5
0
def test_body_get_is_unicode():
    res = Response(app_iter=(["x"] * 51 + [text_(b"x")]))
    with pytest.raises(TypeError):
        res.__getattribute__("body")
Пример #6
0
def test_body_get_is_unicode():
    res = Response(app_iter=(["x"] * 51 + [text_(b"x")]))
    with pytest.raises(TypeError):
        res.__getattribute__("body")