Пример #1
0
def test_text_set_not_unicode():
    res = Response()
    res.charset = 'utf-8'
    with pytest.raises(TypeError):
        res.__setattr__('text',
                        b'La Pe\xc3\xb1a')
Пример #2
0
def test_charset_set_no_content_type_header():
    res = Response()
    res.headers.pop('Content-Type', None)
    with pytest.raises(AttributeError):
        res.__setattr__('charset', 'utf-8')
Пример #3
0
def test_body_set_unicode():
    res = Response()
    with pytest.raises(TypeError):
        res.__setattr__('body', text_(b'abc'))
Пример #4
0
def test_text_set_no_charset():
    res = Response()
    res.charset = None
    with pytest.raises(AttributeError):
        res.__setattr__('text', 'abc')
Пример #5
0
def test_body_set_not_unicode_or_str():
    res = Response()
    with pytest.raises(TypeError):
        res.__setattr__('body', object())
Пример #6
0
def test_text_set_not_unicode():
    res = Response()
    res.charset = "utf-8"
    with pytest.raises(TypeError):
        res.__setattr__("text", b"La Pe\xc3\xb1a")
Пример #7
0
def test_body_set_unicode():
    res = Response()
    with pytest.raises(TypeError):
        res.__setattr__("body", text_(b"abc"))
Пример #8
0
def test_text_set_not_unicode():
    res = Response()
    res.charset = "utf-8"
    with pytest.raises(TypeError):
        res.__setattr__("text", b"La Pe\xc3\xb1a")
Пример #9
0
def test_body_set_unicode():
    res = Response()
    with pytest.raises(TypeError):
        res.__setattr__("body", text_(b"abc"))