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
7cc42c35
Unverified
Kaydet (Commit)
7cc42c35
authored
Ock 02, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Ock 02, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32478: Add tests for 'break' and 'return' inside 'finally' clause. (#5078)
üst
e8ed9655
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
test_grammar.py
Lib/test/test_grammar.py
+74
-0
No files found.
Lib/test/test_grammar.py
Dosyayı görüntüle @
7cc42c35
...
...
@@ -805,6 +805,80 @@ class GrammarTests(unittest.TestCase):
x
=
g2
()
check_syntax_error
(
self
,
"class foo:return 1"
)
def
test_break_in_finally
(
self
):
count
=
0
while
count
<
2
:
count
+=
1
try
:
pass
finally
:
break
self
.
assertEqual
(
count
,
1
)
count
=
0
while
count
<
2
:
count
+=
1
try
:
continue
finally
:
break
self
.
assertEqual
(
count
,
1
)
count
=
0
while
count
<
2
:
count
+=
1
try
:
1
/
0
finally
:
break
self
.
assertEqual
(
count
,
1
)
for
count
in
[
0
,
1
]:
self
.
assertEqual
(
count
,
0
)
try
:
pass
finally
:
break
self
.
assertEqual
(
count
,
0
)
for
count
in
[
0
,
1
]:
self
.
assertEqual
(
count
,
0
)
try
:
continue
finally
:
break
self
.
assertEqual
(
count
,
0
)
for
count
in
[
0
,
1
]:
self
.
assertEqual
(
count
,
0
)
try
:
1
/
0
finally
:
break
self
.
assertEqual
(
count
,
0
)
def
test_return_in_finally
(
self
):
def
g1
():
try
:
pass
finally
:
return
1
self
.
assertEqual
(
g1
(),
1
)
def
g2
():
try
:
return
2
finally
:
return
3
self
.
assertEqual
(
g2
(),
3
)
def
g3
():
try
:
1
/
0
finally
:
return
4
self
.
assertEqual
(
g3
(),
4
)
def
test_yield
(
self
):
# Allowed as standalone statement
def
g
():
yield
1
...
...
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