Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
34aa4453
Commit
34aa4453
authored
Oct 21, 2002
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test_body_encoding(): a new test
parent
3d57589f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
Lib/email/test/test_email.py
Lib/email/test/test_email.py
+23
-0
No files found.
Lib/email/test/test_email.py
View file @
34aa4453
...
...
@@ -2092,6 +2092,29 @@ class TestCharset(unittest.TestCase):
sp
=
c
.
to_splittable
(
s
)
eq
(
s
,
c
.
from_splittable
(
sp
))
def
test_body_encode
(
self
):
eq
=
self
.
assertEqual
# Try a charset with QP body encoding
c
=
Charset
(
'iso-8859-1'
)
eq
(
'hello w=F6rld'
,
c
.
body_encode
(
'hello w
\
xf6
rld'
))
# Try a charset with Base64 body encoding
c
=
Charset
(
'utf-8'
)
eq
(
'aGVsbG8gd29ybGQ=
\
n
'
,
c
.
body_encode
(
'hello world'
))
# Try a charset with None body encoding
c
=
Charset
(
'us-ascii'
)
eq
(
'hello world'
,
c
.
body_encode
(
'hello world'
))
# Try the convert argument, where input codec <> output codec
c
=
Charset
(
'euc-jp'
)
# With apologies to Tokio Kikuchi ;)
try
:
eq
(
'
\
x1b
$B5FCO;~IW
\
x1b
(B'
,
c
.
body_encode
(
'
\
xb5
\
xc6
\
xc3
\
xcf
\
xbb
\
xfe
\
xc9
\
xd7
'
))
eq
(
'
\
xb5
\
xc6
\
xc3
\
xcf
\
xbb
\
xfe
\
xc9
\
xd7
'
,
c
.
body_encode
(
'
\
xb5
\
xc6
\
xc3
\
xcf
\
xbb
\
xfe
\
xc9
\
xd7
'
,
False
))
except
LookupError
:
# We probably don't have the Japanese codecs installed
pass
# Test multilingual MIME headers.
...
...
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