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
95e21471
Unverified
Kaydet (Commit)
95e21471
authored
Ock 29, 2018
tarafından
Nathaniel J. Smith
Kaydeden (comit)
GitHub
Ock 29, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32591: silence deprecation warnings in test_coroutine (GH-5412)
üst
1e5b25b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
test_coroutines.py
Lib/test/test_coroutines.py
+20
-10
No files found.
Lib/test/test_coroutines.py
Dosyayı görüntüle @
95e21471
...
@@ -1981,16 +1981,19 @@ class SysSetCoroWrapperTest(unittest.TestCase):
...
@@ -1981,16 +1981,19 @@ class SysSetCoroWrapperTest(unittest.TestCase):
with
self
.
assertWarns
(
DeprecationWarning
):
with
self
.
assertWarns
(
DeprecationWarning
):
sys
.
set_coroutine_wrapper
(
wrap
)
sys
.
set_coroutine_wrapper
(
wrap
)
self
.
assertIs
(
sys
.
get_coroutine_wrapper
(),
wrap
)
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertIs
(
sys
.
get_coroutine_wrapper
(),
wrap
)
try
:
try
:
f
=
foo
()
f
=
foo
()
self
.
assertTrue
(
wrapped
)
self
.
assertTrue
(
wrapped
)
self
.
assertEqual
(
run_async
(
f
),
([],
'spam'
))
self
.
assertEqual
(
run_async
(
f
),
([],
'spam'
))
finally
:
finally
:
sys
.
set_coroutine_wrapper
(
None
)
with
self
.
assertWarns
(
DeprecationWarning
):
sys
.
set_coroutine_wrapper
(
None
)
self
.
assertIsNone
(
sys
.
get_coroutine_wrapper
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertIsNone
(
sys
.
get_coroutine_wrapper
())
wrapped
=
None
wrapped
=
None
with
silence_coro_gc
():
with
silence_coro_gc
():
...
@@ -1998,10 +2001,13 @@ class SysSetCoroWrapperTest(unittest.TestCase):
...
@@ -1998,10 +2001,13 @@ class SysSetCoroWrapperTest(unittest.TestCase):
self
.
assertFalse
(
wrapped
)
self
.
assertFalse
(
wrapped
)
def
test_set_wrapper_2
(
self
):
def
test_set_wrapper_2
(
self
):
self
.
assertIsNone
(
sys
.
get_coroutine_wrapper
())
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertIsNone
(
sys
.
get_coroutine_wrapper
())
with
self
.
assertRaisesRegex
(
TypeError
,
"callable expected, got int"
):
with
self
.
assertRaisesRegex
(
TypeError
,
"callable expected, got int"
):
sys
.
set_coroutine_wrapper
(
1
)
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertIsNone
(
sys
.
get_coroutine_wrapper
())
sys
.
set_coroutine_wrapper
(
1
)
with
self
.
assertWarns
(
DeprecationWarning
):
self
.
assertIsNone
(
sys
.
get_coroutine_wrapper
())
def
test_set_wrapper_3
(
self
):
def
test_set_wrapper_3
(
self
):
async
def
foo
():
async
def
foo
():
...
@@ -2012,7 +2018,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
...
@@ -2012,7 +2018,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
return
await
coro
return
await
coro
return
wrap
(
coro
)
return
wrap
(
coro
)
sys
.
set_coroutine_wrapper
(
wrapper
)
with
self
.
assertWarns
(
DeprecationWarning
):
sys
.
set_coroutine_wrapper
(
wrapper
)
try
:
try
:
with
silence_coro_gc
(),
self
.
assertRaisesRegex
(
with
silence_coro_gc
(),
self
.
assertRaisesRegex
(
RuntimeError
,
RuntimeError
,
...
@@ -2021,7 +2028,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
...
@@ -2021,7 +2028,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
foo
()
foo
()
finally
:
finally
:
sys
.
set_coroutine_wrapper
(
None
)
with
self
.
assertWarns
(
DeprecationWarning
):
sys
.
set_coroutine_wrapper
(
None
)
def
test_set_wrapper_4
(
self
):
def
test_set_wrapper_4
(
self
):
@types.coroutine
@types.coroutine
...
@@ -2034,7 +2042,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
...
@@ -2034,7 +2042,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
wrapped
=
gen
wrapped
=
gen
return
gen
return
gen
sys
.
set_coroutine_wrapper
(
wrap
)
with
self
.
assertWarns
(
DeprecationWarning
):
sys
.
set_coroutine_wrapper
(
wrap
)
try
:
try
:
foo
()
foo
()
self
.
assertIs
(
self
.
assertIs
(
...
@@ -2042,7 +2051,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
...
@@ -2042,7 +2051,8 @@ class SysSetCoroWrapperTest(unittest.TestCase):
"generator-based coroutine was wrapped via "
"generator-based coroutine was wrapped via "
"sys.set_coroutine_wrapper"
)
"sys.set_coroutine_wrapper"
)
finally
:
finally
:
sys
.
set_coroutine_wrapper
(
None
)
with
self
.
assertWarns
(
DeprecationWarning
):
sys
.
set_coroutine_wrapper
(
None
)
class
OriginTrackingTest
(
unittest
.
TestCase
):
class
OriginTrackingTest
(
unittest
.
TestCase
):
...
...
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