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
9a573a0c
Kaydet (Commit)
9a573a0c
authored
Haz 20, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Added more tests for issue #27122.
üst
b84f029b
ce1a9f30
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
test_contextlib.py
Lib/test/test_contextlib.py
+11
-5
No files found.
Lib/test/test_contextlib.py
Dosyayı görüntüle @
9a573a0c
...
...
@@ -796,8 +796,9 @@ class TestExitStack(unittest.TestCase):
self
.
assertIs
(
stack
.
_exit_callbacks
[
-
1
],
cm
)
def
test_dont_reraise_RuntimeError
(
self
):
"""https://bugs.python.org/issue27122"""
# https://bugs.python.org/issue27122
class
UniqueException
(
Exception
):
pass
class
UniqueRuntimeError
(
RuntimeError
):
pass
@contextmanager
def
second
():
...
...
@@ -813,15 +814,20 @@ class TestExitStack(unittest.TestCase):
except
Exception
as
exc
:
raise
exc
# The RuntimeError should be caught by second()'s exception
# The
Unique
RuntimeError should be caught by second()'s exception
# handler which chain raised a new UniqueException.
with
self
.
assertRaises
(
UniqueException
)
as
err_ctx
:
with
ExitStack
()
as
es_ctx
:
es_ctx
.
enter_context
(
second
())
es_ctx
.
enter_context
(
first
())
raise
RuntimeError
(
"please no infinite loop."
)
self
.
assertEqual
(
err_ctx
.
exception
.
args
[
0
],
"new exception"
)
raise
UniqueRuntimeError
(
"please no infinite loop."
)
exc
=
err_ctx
.
exception
self
.
assertIsInstance
(
exc
,
UniqueException
)
self
.
assertIsInstance
(
exc
.
__context__
,
UniqueRuntimeError
)
self
.
assertIsNone
(
exc
.
__context__
.
__context__
)
self
.
assertIsNone
(
exc
.
__context__
.
__cause__
)
self
.
assertIs
(
exc
.
__cause__
,
exc
.
__context__
)
class
TestRedirectStream
:
...
...
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