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
6130c027
Kaydet (Commit)
6130c027
authored
Kas 07, 2016
tarafından
Yury Selivanov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.5 (issue #28634)
üst
91aa5c12
49d6b8c0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
base_futures.py
Lib/asyncio/base_futures.py
+2
-1
test_futures.py
Lib/test/test_asyncio/test_futures.py
+23
-0
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/asyncio/base_futures.py
Dosyayı görüntüle @
6130c027
...
...
@@ -27,7 +27,8 @@ def isfuture(obj):
itself as duck-type compatible by setting _asyncio_future_blocking.
See comment in Future for more details.
"""
return
getattr
(
obj
,
'_asyncio_future_blocking'
,
None
)
is
not
None
return
(
hasattr
(
obj
.
__class__
,
'_asyncio_future_blocking'
)
and
obj
.
_asyncio_future_blocking
is
not
None
)
def
_format_callbacks
(
cb
):
...
...
Lib/test/test_asyncio/test_futures.py
Dosyayı görüntüle @
6130c027
...
...
@@ -105,6 +105,29 @@ class BaseFutureTests:
self
.
loop
=
self
.
new_test_loop
()
self
.
addCleanup
(
self
.
loop
.
close
)
def
test_isfuture
(
self
):
class
MyFuture
:
_asyncio_future_blocking
=
None
def
__init__
(
self
):
self
.
_asyncio_future_blocking
=
False
self
.
assertFalse
(
asyncio
.
isfuture
(
MyFuture
))
self
.
assertTrue
(
asyncio
.
isfuture
(
MyFuture
()))
self
.
assertFalse
(
asyncio
.
isfuture
(
1
))
# As `isinstance(Mock(), Future)` returns `False`
self
.
assertFalse
(
asyncio
.
isfuture
(
mock
.
Mock
()))
f
=
self
.
_new_future
(
loop
=
self
.
loop
)
self
.
assertTrue
(
asyncio
.
isfuture
(
f
))
self
.
assertFalse
(
asyncio
.
isfuture
(
type
(
f
)))
# As `isinstance(Mock(Future), Future)` returns `True`
self
.
assertTrue
(
asyncio
.
isfuture
(
mock
.
Mock
(
type
(
f
))))
f
.
cancel
()
def
test_initial_state
(
self
):
f
=
self
.
_new_future
(
loop
=
self
.
loop
)
self
.
assertFalse
(
f
.
cancelled
())
...
...
Misc/NEWS
Dosyayı görüntüle @
6130c027
...
...
@@ -25,6 +25,8 @@ Library
- Issue #28613: Fix get_event_loop() return the current loop if
called from coroutines/callbacks.
- Issue #28634: Fix asyncio.isfuture() to support unittest.Mock.
Documentation
-------------
...
...
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