Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
3dcb0cf9
Kaydet (Commit)
3dcb0cf9
authored
Şub 06, 2014
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #20520: Fixed readline test in test_codecs.
üst
bfafa619
5b4fab1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
test_codecs.py
Lib/test/test_codecs.py
+15
-6
No files found.
Lib/test/test_codecs.py
Dosyayı görüntüle @
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