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
3dcb0cf9
Commit
3dcb0cf9
authored
Feb 06, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Plain Diff
Issue #20520: Fixed readline test in test_codecs.
parents
bfafa619
5b4fab1a
Changes
1
Hide 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 @
3dcb0cf9
...
...
@@ -148,19 +148,20 @@ class ReadTest(MixInCheckStateHandling):
self
.
assertEqual
(
readalllines
(
s
,
True
,
10
),
sexpected
)
self
.
assertEqual
(
readalllines
(
s
,
False
,
10
),
sexpectednoends
)
lineends
=
(
"
\
n
"
,
"
\
r
\
n
"
,
"
\
r
"
,
"
\
u2028
"
)
# Test long lines (multiple calls to read() in readline())
vw
=
[]
vwo
=
[]
for
(
i
,
lineend
)
in
enumerate
(
"
\
n
\
r
\
n
\
r
\
u2028
"
.
split
()
):
vw
.
append
((
i
*
200
)
*
"
\
304
2"
+
lineend
)
vwo
.
append
((
i
*
200
)
*
"
\
304
2"
)
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
True
),
""
.
join
(
vw
))
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
False
),
"
"
.
join
(
vwo
))
for
(
i
,
lineend
)
in
enumerate
(
lineends
):
vw
.
append
((
i
*
200
+
200
)
*
"
\
u
3042
"
+
lineend
)
vwo
.
append
((
i
*
200
+
200
)
*
"
\
u
3042
"
)
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
True
),
"
|
"
.
join
(
vw
))
self
.
assertEqual
(
readalllines
(
""
.
join
(
vw
),
False
),
"|
"
.
join
(
vwo
))
# 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
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
"
)
reader
=
getreader
(
s
)
for
i
in
range
(
10
):
...
...
@@ -168,12 +169,20 @@ class ReadTest(MixInCheckStateHandling):
reader
.
readline
(
keepends
=
True
),
size
*
"a"
+
lineend
,
)
self
.
assertEqual
(
reader
.
readline
(
keepends
=
True
),
"xxx
\
n
"
,
)
reader
=
getreader
(
s
)
for
i
in
range
(
10
):
self
.
assertEqual
(
reader
.
readline
(
keepends
=
False
),
size
*
"a"
,
)
self
.
assertEqual
(
reader
.
readline
(
keepends
=
False
),
"xxx"
,
)
def
test_mixed_readline_and_read
(
self
):
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