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
5b4fab1a
Commit
5b4fab1a
authored
Feb 06, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #20520: Fixed readline test in test_codecs.
parent
22d415cf
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
Lib/test/test_codecs.py
Lib/test/test_codecs.py
+15
-6
No files found.
Lib/test/test_codecs.py
View file @
5b4fab1a
...
@@ -146,19 +146,20 @@ class ReadTest(MixInCheckStateHandling):
...
@@ -146,19 +146,20 @@ class ReadTest(MixInCheckStateHandling):
self
.
assertEqual
(
readalllines
(
s
,
True
,
10
),
sexpected
)
self
.
assertEqual
(
readalllines
(
s
,
True
,
10
),
sexpected
)
self
.
assertEqual
(
readalllines
(
s
,
False
,
10
),
sexpectednoends
)
self
.
assertEqual
(
readalllines
(
s
,
False
,
10
),
sexpectednoends
)
lineends
=
(
"
\
n
"
,
"
\
r
\
n
"
,
"
\
r
"
,
"
\
u2028
"
)
# Test long lines (multiple calls to read() in readline())
# Test long lines (multiple calls to read() in readline())
vw
=
[]
vw
=
[]
vwo
=
[]
vwo
=
[]
for
(
i
,
lineend
)
in
enumerate
(
"
\
n
\
r
\
n
\
r
\
u2028
"
.
split
()
):
for
(
i
,
lineend
)
in
enumerate
(
lineends
):
vw
.
append
((
i
*
200
)
*
"
\
304
2"
+
lineend
)
vw
.
append
((
i
*
200
+
200
)
*
"
\
u
3042
"
+
lineend
)
vwo
.
append
((
i
*
200
)
*
"
\
304
2"
)
vwo
.
append
((
i
*
200
+
200
)
*
"
\
u
3042
"
)
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
True
),
""
.
join
(
vw
))
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
True
),
"
|
"
.
join
(
vw
))
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
False
),
"
"
.
join
(
vwo
))
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
False
),
"|
"
.
join
(
vwo
))
# Test lines where the first read might end with \r, so the
# Test lines where the first read might end with \r, so the
# reader has to look ahead whether this is a lone \r or a \r\n
# reader has to look ahead whether this is a lone \r or a \r\n
for
size
in
range
(
80
):
for
size
in
range
(
80
):
for
lineend
in
"
\
n
\
r
\
n
\
r
\
u2028
"
.
split
()
:
for
lineend
in
lineends
:
s
=
10
*
(
size
*
"a"
+
lineend
+
"xxx
\
n
"
)
s
=
10
*
(
size
*
"a"
+
lineend
+
"xxx
\
n
"
)
reader
=
getreader
(
s
)
reader
=
getreader
(
s
)
for
i
in
range
(
10
):
for
i
in
range
(
10
):
...
@@ -166,12 +167,20 @@ class ReadTest(MixInCheckStateHandling):
...
@@ -166,12 +167,20 @@ class ReadTest(MixInCheckStateHandling):
reader
.
readline
(
keepends
=
True
),
reader
.
readline
(
keepends
=
True
),
size
*
"a"
+
lineend
,
size
*
"a"
+
lineend
,
)
)
self
.
assertEqual
(
reader
.
readline
(
keepends
=
True
),
"xxx
\
n
"
,
)
reader
=
getreader
(
s
)
reader
=
getreader
(
s
)
for
i
in
range
(
10
):
for
i
in
range
(
10
):
self
.
assertEqual
(
self
.
assertEqual
(
reader
.
readline
(
keepends
=
False
),
reader
.
readline
(
keepends
=
False
),
size
*
"a"
,
size
*
"a"
,
)
)
self
.
assertEqual
(
reader
.
readline
(
keepends
=
False
),
"xxx"
,
)
def
test_mixed_readline_and_read
(
self
):
def
test_mixed_readline_and_read
(
self
):
lines
=
[
"Humpty Dumpty sat on a wall,
\
n
"
,
lines
=
[
"Humpty Dumpty sat on a wall,
\
n
"
,
...
...
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