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
aabd0b03
Commit
aabd0b03
authored
Jan 11, 2013
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Plain Diff
#16918: merge with 3.3.
parents
45d5de15
5d3dba0d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
46 deletions
+16
-46
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+13
-46
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_codecs.py
View file @
aabd0b03
...
@@ -74,7 +74,7 @@ class MixInCheckStateHandling:
...
@@ -74,7 +74,7 @@ class MixInCheckStateHandling:
part2
=
d
.
encode
(
u
[
i
:],
True
)
part2
=
d
.
encode
(
u
[
i
:],
True
)
self
.
assertEqual
(
s
,
part1
+
part2
)
self
.
assertEqual
(
s
,
part1
+
part2
)
class
ReadTest
(
unittest
.
TestCase
,
MixInCheckStateHandling
):
class
ReadTest
(
MixInCheckStateHandling
):
def
check_partial
(
self
,
input
,
partialresults
):
def
check_partial
(
self
,
input
,
partialresults
):
# get a StreamReader for the encoding and feed the bytestring version
# get a StreamReader for the encoding and feed the bytestring version
# of input to the reader byte by byte. Read everything available from
# of input to the reader byte by byte. Read everything available from
...
@@ -294,7 +294,7 @@ class ReadTest(unittest.TestCase, MixInCheckStateHandling):
...
@@ -294,7 +294,7 @@ class ReadTest(unittest.TestCase, MixInCheckStateHandling):
self
.
assertEqual
(
reader
.
readline
(),
s5
)
self
.
assertEqual
(
reader
.
readline
(),
s5
)
self
.
assertEqual
(
reader
.
readline
(),
""
)
self
.
assertEqual
(
reader
.
readline
(),
""
)
class
UTF32Test
(
ReadTest
):
class
UTF32Test
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-32"
encoding
=
"utf-32"
spamle
=
(
b'
\
xff
\
xfe
\
x00
\
x00
'
spamle
=
(
b'
\
xff
\
xfe
\
x00
\
x00
'
...
@@ -385,7 +385,7 @@ class UTF32Test(ReadTest):
...
@@ -385,7 +385,7 @@ class UTF32Test(ReadTest):
self
.
assertEqual
(
'
\
U00010000
'
*
1024
,
self
.
assertEqual
(
'
\
U00010000
'
*
1024
,
codecs
.
utf_32_decode
(
encoded_be
)[
0
])
codecs
.
utf_32_decode
(
encoded_be
)[
0
])
class
UTF32LETest
(
ReadTest
):
class
UTF32LETest
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-32-le"
encoding
=
"utf-32-le"
def
test_partial
(
self
):
def
test_partial
(
self
):
...
@@ -429,7 +429,7 @@ class UTF32LETest(ReadTest):
...
@@ -429,7 +429,7 @@ class UTF32LETest(ReadTest):
self
.
assertEqual
(
'
\
U00010000
'
*
1024
,
self
.
assertEqual
(
'
\
U00010000
'
*
1024
,
codecs
.
utf_32_le_decode
(
encoded
)[
0
])
codecs
.
utf_32_le_decode
(
encoded
)[
0
])
class
UTF32BETest
(
ReadTest
):
class
UTF32BETest
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-32-be"
encoding
=
"utf-32-be"
def
test_partial
(
self
):
def
test_partial
(
self
):
...
@@ -474,7 +474,7 @@ class UTF32BETest(ReadTest):
...
@@ -474,7 +474,7 @@ class UTF32BETest(ReadTest):
codecs
.
utf_32_be_decode
(
encoded
)[
0
])
codecs
.
utf_32_be_decode
(
encoded
)[
0
])
class
UTF16Test
(
ReadTest
):
class
UTF16Test
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-16"
encoding
=
"utf-16"
spamle
=
b'
\
xff
\
xfe
s
\
x00
p
\
x00
a
\
x00
m
\
x00
s
\
x00
p
\
x00
a
\
x00
m
\
x00
'
spamle
=
b'
\
xff
\
xfe
s
\
x00
p
\
x00
a
\
x00
m
\
x00
s
\
x00
p
\
x00
a
\
x00
m
\
x00
'
...
@@ -554,7 +554,7 @@ class UTF16Test(ReadTest):
...
@@ -554,7 +554,7 @@ class UTF16Test(ReadTest):
with
codecs
.
open
(
support
.
TESTFN
,
'U'
,
encoding
=
self
.
encoding
)
as
reader
:
with
codecs
.
open
(
support
.
TESTFN
,
'U'
,
encoding
=
self
.
encoding
)
as
reader
:
self
.
assertEqual
(
reader
.
read
(),
s1
)
self
.
assertEqual
(
reader
.
read
(),
s1
)
class
UTF16LETest
(
ReadTest
):
class
UTF16LETest
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-16-le"
encoding
=
"utf-16-le"
def
test_partial
(
self
):
def
test_partial
(
self
):
...
@@ -597,7 +597,7 @@ class UTF16LETest(ReadTest):
...
@@ -597,7 +597,7 @@ class UTF16LETest(ReadTest):
self
.
assertEqual
(
b'
\
x00
\
xd8
\
x03
\
xde
'
.
decode
(
self
.
encoding
),
self
.
assertEqual
(
b'
\
x00
\
xd8
\
x03
\
xde
'
.
decode
(
self
.
encoding
),
"
\
U00010203
"
)
"
\
U00010203
"
)
class
UTF16BETest
(
ReadTest
):
class
UTF16BETest
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-16-be"
encoding
=
"utf-16-be"
def
test_partial
(
self
):
def
test_partial
(
self
):
...
@@ -640,7 +640,7 @@ class UTF16BETest(ReadTest):
...
@@ -640,7 +640,7 @@ class UTF16BETest(ReadTest):
self
.
assertEqual
(
b'
\
xd8
\
x00
\
xde
\
x03
'
.
decode
(
self
.
encoding
),
self
.
assertEqual
(
b'
\
xd8
\
x00
\
xde
\
x03
'
.
decode
(
self
.
encoding
),
"
\
U00010203
"
)
"
\
U00010203
"
)
class
UTF8Test
(
ReadTest
):
class
UTF8Test
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-8"
encoding
=
"utf-8"
def
test_partial
(
self
):
def
test_partial
(
self
):
...
@@ -701,7 +701,7 @@ class UTF8Test(ReadTest):
...
@@ -701,7 +701,7 @@ class UTF8Test(ReadTest):
@
unittest
.
skipUnless
(
sys
.
platform
==
'win32'
,
@
unittest
.
skipUnless
(
sys
.
platform
==
'win32'
,
'cp65001 is a Windows-only codec'
)
'cp65001 is a Windows-only codec'
)
class
CP65001Test
(
ReadTest
):
class
CP65001Test
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"cp65001"
encoding
=
"cp65001"
def
test_encode
(
self
):
def
test_encode
(
self
):
...
@@ -800,7 +800,7 @@ class CP65001Test(ReadTest):
...
@@ -800,7 +800,7 @@ class CP65001Test(ReadTest):
class
UTF7Test
(
ReadTest
):
class
UTF7Test
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-7"
encoding
=
"utf-7"
def
test_partial
(
self
):
def
test_partial
(
self
):
...
@@ -839,7 +839,7 @@ class ReadBufferTest(unittest.TestCase):
...
@@ -839,7 +839,7 @@ class ReadBufferTest(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
codecs
.
readbuffer_encode
)
self
.
assertRaises
(
TypeError
,
codecs
.
readbuffer_encode
)
self
.
assertRaises
(
TypeError
,
codecs
.
readbuffer_encode
,
42
)
self
.
assertRaises
(
TypeError
,
codecs
.
readbuffer_encode
,
42
)
class
UTF8SigTest
(
ReadTest
):
class
UTF8SigTest
(
ReadTest
,
unittest
.
TestCase
):
encoding
=
"utf-8-sig"
encoding
=
"utf-8-sig"
def
test_partial
(
self
):
def
test_partial
(
self
):
...
@@ -925,7 +925,7 @@ class UTF8SigTest(ReadTest):
...
@@ -925,7 +925,7 @@ class UTF8SigTest(ReadTest):
class
EscapeDecodeTest
(
unittest
.
TestCase
):
class
EscapeDecodeTest
(
unittest
.
TestCase
):
def
test_empty
(
self
):
def
test_empty
(
self
):
self
.
assertEqual
(
codecs
.
escape_decode
(
""
),
(
""
,
0
))
self
.
assertEqual
(
codecs
.
escape_decode
(
""
),
(
b
""
,
0
))
class
RecodingTest
(
unittest
.
TestCase
):
class
RecodingTest
(
unittest
.
TestCase
):
def
test_recoding
(
self
):
def
test_recoding
(
self
):
...
@@ -2207,38 +2207,5 @@ class CodePageTest(unittest.TestCase):
...
@@ -2207,38 +2207,5 @@ class CodePageTest(unittest.TestCase):
self
.
assertEqual
(
decoded
,
(
'abc'
,
3
))
self
.
assertEqual
(
decoded
,
(
'abc'
,
3
))
def
test_main
():
support
.
run_unittest
(
UTF32Test
,
UTF32LETest
,
UTF32BETest
,
UTF16Test
,
UTF16LETest
,
UTF16BETest
,
UTF8Test
,
UTF8SigTest
,
CP65001Test
,
UTF7Test
,
UTF16ExTest
,
ReadBufferTest
,
RecodingTest
,
PunycodeTest
,
UnicodeInternalTest
,
NameprepTest
,
IDNACodecTest
,
CodecsModuleTest
,
StreamReaderTest
,
EncodedFileTest
,
BasicUnicodeTest
,
CharmapTest
,
WithStmtTest
,
TypesTest
,
SurrogateEscapeTest
,
BomTest
,
TransformCodecTest
,
CodePageTest
,
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
test_
main
()
unittest
.
main
()
Misc/NEWS
View file @
aabd0b03
...
@@ -620,6 +620,9 @@ Tests
...
@@ -620,6 +620,9 @@ Tests
-
Issue
#
16836
:
Enable
IPv6
support
even
if
IPv6
is
disabled
on
the
build
host
.
-
Issue
#
16836
:
Enable
IPv6
support
even
if
IPv6
is
disabled
on
the
build
host
.
-
Issue
#
16918
:
test_codecs
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
-
Issue
#
16919
:
test_crypt
now
works
with
unittest
test
discovery
.
-
Issue
#
16919
:
test_crypt
now
works
with
unittest
test
discovery
.
Patch
by
Zachary
Ware
.
Patch
by
Zachary
Ware
.
...
...
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