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
aa960885
Commit
aa960885
authored
Jul 21, 2012
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Plain Diff
Port additional tests from #14579 (the issue is already fixed).
parents
3e8e9732
e67950bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+26
-4
No files found.
Lib/test/test_codecs.py
View file @
aa960885
...
...
@@ -557,8 +557,19 @@ class UTF16LETest(ReadTest):
)
def
test_errors
(
self
):
self
.
assertRaises
(
UnicodeDecodeError
,
codecs
.
utf_16_le_decode
,
b"
\
xff
"
,
"strict"
,
True
)
tests
=
[
(
b'
\
xff
'
,
'
\
ufffd
'
),
(
b'A
\
x00
Z'
,
'A
\
ufffd
'
),
(
b'A
\
x00
B
\
x00
C
\
x00
D
\
x00
Z'
,
'ABCD
\
ufffd
'
),
(
b'
\
x00
\
xd8
'
,
'
\
ufffd
'
),
(
b'
\
x00
\
xd8
A'
,
'
\
ufffd
'
),
(
b'
\
x00
\
xd8
A
\
x00
'
,
'
\
ufffd
A'
),
(
b'
\
x00
\
xdc
A
\
x00
'
,
'
\
ufffd
A'
),
]
for
raw
,
expected
in
tests
:
self
.
assertRaises
(
UnicodeDecodeError
,
codecs
.
utf_16_le_decode
,
raw
,
'strict'
,
True
)
self
.
assertEqual
(
raw
.
decode
(
'utf-16le'
,
'replace'
),
expected
)
def
test_nonbmp
(
self
):
self
.
assertEqual
(
"
\
U00010203
"
.
encode
(
self
.
encoding
),
...
...
@@ -585,8 +596,19 @@ class UTF16BETest(ReadTest):
)
def
test_errors
(
self
):
self
.
assertRaises
(
UnicodeDecodeError
,
codecs
.
utf_16_be_decode
,
b"
\
xff
"
,
"strict"
,
True
)
tests
=
[
(
b'
\
xff
'
,
'
\
ufffd
'
),
(
b'
\
x00
A
\
xff
'
,
'A
\
ufffd
'
),
(
b'
\
x00
A
\
x00
B
\
x00
C
\
x00
DZ'
,
'ABCD
\
ufffd
'
),
(
b'
\
xd8
\
x00
'
,
'
\
ufffd
'
),
(
b'
\
xd8
\
x00
\
xdc
'
,
'
\
ufffd
'
),
(
b'
\
xd8
\
x00
\
x00
A'
,
'
\
ufffd
A'
),
(
b'
\
xdc
\
x00
\
x00
A'
,
'
\
ufffd
A'
),
]
for
raw
,
expected
in
tests
:
self
.
assertRaises
(
UnicodeDecodeError
,
codecs
.
utf_16_be_decode
,
raw
,
'strict'
,
True
)
self
.
assertEqual
(
raw
.
decode
(
'utf-16be'
,
'replace'
),
expected
)
def
test_nonbmp
(
self
):
self
.
assertEqual
(
"
\
U00010203
"
.
encode
(
self
.
encoding
),
...
...
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