Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
logilab-common
Commits
9d9635c03b61
Commit
4d08ef2f
authored
Jul 28, 2021
by
Laurent Peuch
Browse files
chore: convert test/test_umessage.py to utf-8 because it's 2021
parent
46b8ef8b2454
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/test_umessage.py
View file @
9d9635c0
# encoding:
iso-8859-15
# encoding:
utf-8
# copyright 2003-2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
...
...
@@ -42,12 +42,12 @@ class UMessageTC(TestCase):
def
test_get_subject
(
self
):
subj
=
self
.
umessage2
.
get
(
"Subject"
)
self
.
assertEqual
(
type
(
subj
),
str
)
self
.
assertEqual
(
subj
,
" LA MER"
)
self
.
assertEqual
(
subj
,
"
À
LA MER"
)
def
test_get_all
(
self
):
to
=
self
.
umessage2
.
get_all
(
"To"
)
self
.
assertEqual
(
type
(
to
[
0
]),
str
)
self
.
assertEqual
(
to
,
[
"
l
ment accents <alf@logilab.fr>"
])
self
.
assertEqual
(
to
,
[
"
élé
ment
à
accents <alf@logilab.fr>"
])
def
test_get_payload_no_multi
(
self
):
payload
=
self
.
umessage1
.
get_payload
()
...
...
@@ -68,19 +68,19 @@ Date: now
dW4gcGV0aXQgY8O2dWNvdQ==
"""
msg
=
message_from_string
(
msg
)
self
.
assertEqual
(
msg
.
get_payload
(
decode
=
True
),
"un petit cucou"
)
self
.
assertEqual
(
msg
.
get_payload
(
decode
=
True
),
"un petit c
ö
ucou"
)
def
test_decode_QP
(
self
):
test_line
=
"=??b?UmFwaGHrbA==?= DUPONT<raphael.dupont@societe.fr>"
test
=
decode_QP
(
test_line
)
self
.
assertEqual
(
type
(
test
),
str
)
self
.
assertEqual
(
test
,
"Raphal DUPONT<raphael.dupont@societe.fr>"
)
self
.
assertEqual
(
test
,
"Rapha
ë
l DUPONT<raphael.dupont@societe.fr>"
)
def
test_decode_QP_utf8
(
self
):
test_line
=
"=?utf-8?q?o=C3=AEm?= <oim@logilab.fr>"
test
=
decode_QP
(
test_line
)
self
.
assertEqual
(
type
(
test
),
str
)
self
.
assertEqual
(
test
,
"om <oim@logilab.fr>"
)
self
.
assertEqual
(
test
,
"o
î
m <oim@logilab.fr>"
)
def
test_decode_QP_ascii
(
self
):
test_line
=
"test <test@logilab.fr>"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment