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
d94c1b92
Kaydet (Commit)
d94c1b92
authored
Eyl 29, 2015
tarafından
Andrew Svetlov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix StreamReader.__repr__
üst
85976b14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
streams.py
Lib/asyncio/streams.py
+1
-1
test_streams.py
Lib/test/test_asyncio/test_streams.py
+42
-0
No files found.
Lib/asyncio/streams.py
Dosyayı görüntüle @
d94c1b92
...
...
@@ -324,7 +324,7 @@ class StreamReader:
def
__repr__
(
self
):
info
=
[
'StreamReader'
]
if
self
.
_buffer
:
info
.
append
(
'
%
d bytes'
%
len
(
info
))
info
.
append
(
'
%
d bytes'
%
len
(
self
.
_buffer
))
if
self
.
_eof
:
info
.
append
(
'eof'
)
if
self
.
_limit
!=
_DEFAULT_LIMIT
:
...
...
Lib/test/test_asyncio/test_streams.py
Dosyayı görüntüle @
d94c1b92
...
...
@@ -632,6 +632,48 @@ os.close(fd)
protocol
=
asyncio
.
StreamReaderProtocol
(
reader
)
self
.
assertIs
(
protocol
.
_loop
,
self
.
loop
)
def
test___repr__
(
self
):
stream
=
asyncio
.
StreamReader
(
loop
=
self
.
loop
)
self
.
assertEqual
(
"<StreamReader>"
,
repr
(
stream
))
def
test___repr__nondefault_limit
(
self
):
stream
=
asyncio
.
StreamReader
(
loop
=
self
.
loop
,
limit
=
123
)
self
.
assertEqual
(
"<StreamReader l=123>"
,
repr
(
stream
))
def
test___repr__eof
(
self
):
stream
=
asyncio
.
StreamReader
(
loop
=
self
.
loop
)
stream
.
feed_eof
()
self
.
assertEqual
(
"<StreamReader eof>"
,
repr
(
stream
))
def
test___repr__data
(
self
):
stream
=
asyncio
.
StreamReader
(
loop
=
self
.
loop
)
stream
.
feed_data
(
b
'data'
)
self
.
assertEqual
(
"<StreamReader 4 bytes>"
,
repr
(
stream
))
def
test___repr__exception
(
self
):
stream
=
asyncio
.
StreamReader
(
loop
=
self
.
loop
)
exc
=
RuntimeError
()
stream
.
set_exception
(
exc
)
self
.
assertEqual
(
"<StreamReader e=RuntimeError()>"
,
repr
(
stream
))
def
test___repr__waiter
(
self
):
stream
=
asyncio
.
StreamReader
(
loop
=
self
.
loop
)
stream
.
_waiter
=
asyncio
.
Future
(
loop
=
self
.
loop
)
self
.
assertRegex
(
repr
(
stream
),
"<StreamReader w=<Future pending[
\
S ]*>>"
)
stream
.
_waiter
.
set_result
(
None
)
self
.
loop
.
run_until_complete
(
stream
.
_waiter
)
stream
.
_waiter
=
None
self
.
assertEqual
(
"<StreamReader>"
,
repr
(
stream
))
def
test___repr__transport
(
self
):
stream
=
asyncio
.
StreamReader
(
loop
=
self
.
loop
)
stream
.
_transport
=
mock
.
Mock
()
stream
.
_transport
.
__repr__
=
mock
.
Mock
()
stream
.
_transport
.
__repr__
.
return_value
=
"<Transport>"
self
.
assertEqual
(
"<StreamReader t=<Transport>>"
,
repr
(
stream
))
if
__name__
==
'__main__'
:
unittest
.
main
()
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