示例#1
0
def test_decode_text():
    assert decode_text("") == ""
    assert decode_text("ascii") == "ascii"

    assert (
        decode_text(encode_text("ascii", EmailEncoding.BASE64), EmailEncoding.BASE64)
        == "ascii"
    )
    assert (
        decode_text(
            encode_text("mèo méo 🇪🇺", EmailEncoding.BASE64), EmailEncoding.BASE64
        )
        == "mèo méo 🇪🇺"
    )

    assert (
        decode_text(encode_text("ascii", EmailEncoding.QUOTED), EmailEncoding.QUOTED)
        == "ascii"
    )
    assert (
        decode_text(
            encode_text("mèo méo 🇪🇺", EmailEncoding.QUOTED), EmailEncoding.QUOTED
        )
        == "mèo méo 🇪🇺"
    )
示例#2
0
def test_encode_text():
    assert encode_text("") == ""
    assert encode_text("ascii") == "ascii"
    assert encode_text("ascii", EmailEncoding.BASE64) == "YXNjaWk="
    assert encode_text("ascii", EmailEncoding.QUOTED) == "ascii"

    assert encode_text("mèo méo") == "mèo méo"
    assert encode_text("mèo méo", EmailEncoding.BASE64) == "bcOobyBtw6lv"
    assert encode_text("mèo méo", EmailEncoding.QUOTED) == "m=C3=A8o m=C3=A9o"