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
a70d5ff9
Kaydet (Commit)
a70d5ff9
authored
Ock 04, 2018
tarafından
Miss Islington (bot)
Kaydeden (comit)
Serhiy Storchaka
Ock 04, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-32482: Fix suspicious code in tests for syntax and grammar. (GH-5086) (#5095)
(cherry picked from commit
0cc99c8c
)
üst
1e6d8525
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
test_grammar.py
Lib/test/test_grammar.py
+5
-6
test_syntax.py
Lib/test/test_syntax.py
+2
-2
No files found.
Lib/test/test_grammar.py
Dosyayı görüntüle @
a70d5ff9
...
@@ -575,6 +575,10 @@ class GrammarTests(unittest.TestCase):
...
@@ -575,6 +575,10 @@ class GrammarTests(unittest.TestCase):
self
.
assertEqual
(
f
(
spam
=
'fried'
,
**
{
'eggs'
:
'scrambled'
}),
self
.
assertEqual
(
f
(
spam
=
'fried'
,
**
{
'eggs'
:
'scrambled'
}),
((),
{
'eggs'
:
'scrambled'
,
'spam'
:
'fried'
}))
((),
{
'eggs'
:
'scrambled'
,
'spam'
:
'fried'
}))
# Check ast errors in *args and *kwargs
check_syntax_error
(
self
,
"f(*g(1=2))"
)
check_syntax_error
(
self
,
"f(**g(1=2))"
)
# argument annotation tests
# argument annotation tests
def
f
(
x
)
->
list
:
pass
def
f
(
x
)
->
list
:
pass
self
.
assertEqual
(
f
.
__annotations__
,
{
'return'
:
list
})
self
.
assertEqual
(
f
.
__annotations__
,
{
'return'
:
list
})
...
@@ -616,10 +620,6 @@ class GrammarTests(unittest.TestCase):
...
@@ -616,10 +620,6 @@ class GrammarTests(unittest.TestCase):
def
f
(
*
,
k
=
1
):
return
closure
def
f
(
*
,
k
=
1
):
return
closure
def
f
()
->
int
:
return
closure
def
f
()
->
int
:
return
closure
# Check ast errors in *args and *kwargs
check_syntax_error
(
self
,
"f(*g(1=2))"
)
check_syntax_error
(
self
,
"f(**g(1=2))"
)
# Check trailing commas are permitted in funcdef argument list
# Check trailing commas are permitted in funcdef argument list
def
f
(
a
,):
pass
def
f
(
a
,):
pass
def
f
(
*
args
,):
pass
def
f
(
*
args
,):
pass
...
@@ -1056,7 +1056,6 @@ class GrammarTests(unittest.TestCase):
...
@@ -1056,7 +1056,6 @@ class GrammarTests(unittest.TestCase):
try
:
1
/
0
try
:
1
/
0
except
EOFError
:
pass
except
EOFError
:
pass
except
TypeError
as
msg
:
pass
except
TypeError
as
msg
:
pass
except
RuntimeError
as
msg
:
pass
except
:
pass
except
:
pass
else
:
pass
else
:
pass
try
:
1
/
0
try
:
1
/
0
...
@@ -1165,7 +1164,7 @@ class GrammarTests(unittest.TestCase):
...
@@ -1165,7 +1164,7 @@ class GrammarTests(unittest.TestCase):
d
[
1
,
2
]
=
3
d
[
1
,
2
]
=
3
d
[
1
,
2
,
3
]
=
4
d
[
1
,
2
,
3
]
=
4
L
=
list
(
d
)
L
=
list
(
d
)
L
.
sort
(
key
=
lambda
x
:
x
if
isinstance
(
x
,
tuple
)
else
(
))
L
.
sort
(
key
=
lambda
x
:
(
type
(
x
)
.
__name__
,
x
))
self
.
assertEqual
(
str
(
L
),
'[1, (1,), (1, 2), (1, 2, 3)]'
)
self
.
assertEqual
(
str
(
L
),
'[1, (1,), (1, 2), (1, 2, 3)]'
)
def
test_atoms
(
self
):
def
test_atoms
(
self
):
...
...
Lib/test/test_syntax.py
Dosyayı görüntüle @
a70d5ff9
...
@@ -600,12 +600,12 @@ class SyntaxTestCase(unittest.TestCase):
...
@@ -600,12 +600,12 @@ class SyntaxTestCase(unittest.TestCase):
"positional argument follows keyword argument"
)
"positional argument follows keyword argument"
)
def
test_kwargs_last2
(
self
):
def
test_kwargs_last2
(
self
):
self
.
_check_error
(
"int(**{
base
: 10}, '2')"
,
self
.
_check_error
(
"int(**{
'base'
: 10}, '2')"
,
"positional argument follows "
"positional argument follows "
"keyword argument unpacking"
)
"keyword argument unpacking"
)
def
test_kwargs_last3
(
self
):
def
test_kwargs_last3
(
self
):
self
.
_check_error
(
"int(**{
base
: 10}, *['2'])"
,
self
.
_check_error
(
"int(**{
'base'
: 10}, *['2'])"
,
"iterable argument unpacking follows "
"iterable argument unpacking follows "
"keyword argument unpacking"
)
"keyword argument unpacking"
)
...
...
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