Esempio n. 1
0
def test_decode_text_non_ascii():
    value = b'abc \xff xyz'
    assert isinstance(value, bytes)

    decoded = decode_text(value)
    assert not isinstance(decoded, bytes)

    assert decoded.startswith('abc')
    assert decoded.endswith('xyz')
Esempio n. 2
0
def _printable(value):
    try:
        return decode_text(repr(value))
    except Exception as e:
        return '<repr(%s) raised %s: %s>' % (
               object.__repr__(value), type(e).__name__, e)
Esempio n. 3
0
def test_decode_text_ascii():
    value = 'abc'
    assert decode_text(value.encode('ascii')) == value
Esempio n. 4
0
def test_decode_text_unicode():
    value = u'\uffff'
    decoded = decode_text(value)
    assert decoded == value