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
fe7b4053
Kaydet (Commit)
fe7b4053
authored
Eyl 10, 2010
tarafından
Amaury Forgeot d'Arc
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
The "if 1": trick seems cleaner that the one with regular expressions.
Use it here again.
üst
8e6b407d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
test_syntax.py
Lib/test/test_syntax.py
+13
-13
No files found.
Lib/test/test_syntax.py
Dosyayı görüntüle @
fe7b4053
...
@@ -550,13 +550,13 @@ class SyntaxTestCase(unittest.TestCase):
...
@@ -550,13 +550,13 @@ class SyntaxTestCase(unittest.TestCase):
def
test_global_err_then_warn
(
self
):
def
test_global_err_then_warn
(
self
):
# Bug tickler: The SyntaxError raised for one global statement
# Bug tickler: The SyntaxError raised for one global statement
# shouldn't be clobbered by a SyntaxWarning issued for a later one.
# shouldn't be clobbered by a SyntaxWarning issued for a later one.
source
=
re
.
sub
(
'(?m)^ *:'
,
''
,
"""
\
source
=
"""if 1:
:
def error(a):
def error(a):
:
global a # SyntaxError
global a # SyntaxError
:
def warning():
def warning():
:
b = 1
b = 1
:
global b # SyntaxWarning
global b # SyntaxWarning
:"""
)
"""
warnings
.
filterwarnings
(
action
=
'ignore'
,
category
=
SyntaxWarning
)
warnings
.
filterwarnings
(
action
=
'ignore'
,
category
=
SyntaxWarning
)
self
.
_check_error
(
source
,
"global"
)
self
.
_check_error
(
source
,
"global"
)
warnings
.
filters
.
pop
(
0
)
warnings
.
filters
.
pop
(
0
)
...
@@ -565,12 +565,12 @@ class SyntaxTestCase(unittest.TestCase):
...
@@ -565,12 +565,12 @@ class SyntaxTestCase(unittest.TestCase):
self
.
_check_error
(
"break"
,
"outside loop"
)
self
.
_check_error
(
"break"
,
"outside loop"
)
def
test_delete_deref
(
self
):
def
test_delete_deref
(
self
):
source
=
re
.
sub
(
'(?m)^ *:'
,
''
,
"""
\
source
=
"""if 1:
:
def foo(x):
def foo(x):
:
def bar():
def bar():
:
print(x)
print(x)
:
del x
del x
:"""
)
"""
self
.
_check_error
(
source
,
"nested scope"
)
self
.
_check_error
(
source
,
"nested scope"
)
def
test_unexpected_indent
(
self
):
def
test_unexpected_indent
(
self
):
...
...
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