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
431b80ca
Commit
431b80ca
authored
Jun 19, 2001
by
Marc-André Lemburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test by Martin v. Loewis for the new UTF-16 codec handling of BOM
marks.
parent
c8ec6d57
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+25
-0
No files found.
Lib/test/test_codecs.py
0 → 100644
View file @
431b80ca
import
test_support
,
unittest
import
codecs
import
StringIO
class
UTF16Test
(
unittest
.
TestCase
):
spamle
=
'
\
xff
\
xfe
s
\
x00
p
\
x00
a
\
x00
m
\
x00
s
\
x00
p
\
x00
a
\
x00
m
\
x00
'
spambe
=
'
\
xfe
\
xff
\
x00
s
\
x00
p
\
x00
a
\
x00
m
\
x00
s
\
x00
p
\
x00
a
\
x00
m'
def
test_only_one_bom
(
self
):
_
,
_
,
reader
,
writer
=
codecs
.
lookup
(
"utf-16"
)
# encode some stream
s
=
StringIO
.
StringIO
()
f
=
writer
(
s
)
f
.
write
(
u"spam"
)
f
.
write
(
u"spam"
)
d
=
s
.
getvalue
()
# check whether there is exactly one BOM in it
self
.
assert_
(
d
==
self
.
spamle
or
d
==
self
.
spambe
)
# try to read it back
s
=
StringIO
.
StringIO
(
d
)
f
=
reader
(
s
)
self
.
assertEquals
(
f
.
read
(),
u"spamspam"
)
test_support
.
run_unittest
(
UTF16Test
)
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