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
32c2ae7f
Kaydet (Commit)
32c2ae7f
authored
Agu 22, 2002
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Standardize behavior: no docstrings in test functions.
üst
2e8bba5c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
test_parser.py
Lib/test/test_parser.py
+7
-5
test_pprint.py
Lib/test/test_pprint.py
+6
-5
No files found.
Lib/test/test_parser.py
Dosyayı görüntüle @
32c2ae7f
...
...
@@ -9,6 +9,7 @@ from test import test_support
#
class
RoundtripLegalSyntaxTestCase
(
unittest
.
TestCase
):
def
roundtrip
(
self
,
f
,
s
):
st1
=
f
(
s
)
t
=
st1
.
totuple
()
...
...
@@ -134,6 +135,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
#
class
IllegalSyntaxTestCase
(
unittest
.
TestCase
):
def
check_bad_tree
(
self
,
tree
,
label
):
try
:
parser
.
sequence2st
(
tree
)
...
...
@@ -147,7 +149,7 @@ class IllegalSyntaxTestCase(unittest.TestCase):
self
.
check_bad_tree
((
1
,
2
,
3
),
"<junk>"
)
def
test_illegal_yield_1
(
self
):
"""Illegal yield statement: def f(): return 1; yield 1"""
# Illegal yield statement: def f(): return 1; yield 1
tree
=
\
(
257
,
(
264
,
...
...
@@ -202,7 +204,7 @@ class IllegalSyntaxTestCase(unittest.TestCase):
self
.
check_bad_tree
(
tree
,
"def f():
\n
return 1
\n
yield 1"
)
def
test_illegal_yield_2
(
self
):
"""Illegal return in generator: def f(): return 1; yield 1"""
# Illegal return in generator: def f(): return 1; yield 1
tree
=
\
(
257
,
(
264
,
...
...
@@ -266,7 +268,7 @@ class IllegalSyntaxTestCase(unittest.TestCase):
self
.
check_bad_tree
(
tree
,
"def f():
\n
return 1
\n
yield 1"
)
def
test_print_chevron_comma
(
self
):
"""Illegal input: print >>fp,"""
# Illegal input: print >>fp,
tree
=
\
(
257
,
(
264
,
...
...
@@ -289,7 +291,7 @@ class IllegalSyntaxTestCase(unittest.TestCase):
self
.
check_bad_tree
(
tree
,
"print >>fp,"
)
def
test_a_comma_comma_c
(
self
):
"""Illegal input: a,,c"""
# Illegal input: a,,c
tree
=
\
(
258
,
(
311
,
...
...
@@ -316,7 +318,7 @@ class IllegalSyntaxTestCase(unittest.TestCase):
self
.
check_bad_tree
(
tree
,
"a,,c"
)
def
test_illegal_operator
(
self
):
"""Illegal input: a $= b"""
# Illegal input: a $= b
tree
=
\
(
257
,
(
264
,
...
...
Lib/test/test_pprint.py
Dosyayı görüntüle @
32c2ae7f
...
...
@@ -16,7 +16,7 @@ class QueryTestCase(unittest.TestCase):
self
.
a
[
-
12
]
=
self
.
b
def
test_basic
(
self
):
"""Verify .isrecursive() and .isreadable() w/o recursion."""
# Verify .isrecursive() and .isreadable() w/o recursion
verify
=
self
.
assert_
for
safe
in
(
2
,
2.0
,
2
j
,
"abc"
,
[
3
],
(
2
,
2
),
{
3
:
3
},
uni
(
"yaddayadda"
),
self
.
a
,
self
.
b
):
...
...
@@ -26,7 +26,7 @@ class QueryTestCase(unittest.TestCase):
"expected isreadable for "
+
`safe`
)
def
test_knotted
(
self
):
"""Verify .isrecursive() and .isreadable() w/ recursion."""
# Verify .isrecursive() and .isreadable() w/ recursion
# Tie a knot.
self
.
b
[
67
]
=
self
.
a
# Messy dict.
...
...
@@ -51,7 +51,7 @@ class QueryTestCase(unittest.TestCase):
"expected isreadable for "
+
`safe`
)
def
test_unreadable
(
self
):
"""Not recursive but not readable anyway."""
# Not recursive but not readable anyway
verify
=
self
.
assert_
for
unreadable
in
type
(
3
),
pprint
,
pprint
.
isrecursive
:
verify
(
not
pprint
.
isrecursive
(
unreadable
),
...
...
@@ -60,7 +60,7 @@ class QueryTestCase(unittest.TestCase):
"expected not isreadable for "
+
`unreadable`
)
def
test_same_as_repr
(
self
):
"Simple objects and small containers that should be same as repr()."
# Simple objects and small containers that should be same as repr()
verify
=
self
.
assert_
for
simple
in
(
0
,
0L
,
0
+
0
j
,
0.0
,
""
,
uni
(
""
),
(),
[],
{},
verify
,
pprint
,
-
6
,
-
6L
,
-
6
-
6
j
,
-
1.5
,
"x"
,
uni
(
"x"
),
(
3
,),
[
3
],
{
3
:
6
},
...
...
@@ -77,7 +77,7 @@ class QueryTestCase(unittest.TestCase):
def
test_basic_line_wrap
(
self
):
"""verify basic line-wrapping operation"""
# verify basic line-wrapping operation
o
=
{
'RPM_cal'
:
0
,
'RPM_cal2'
:
48059
,
'Speed_cal'
:
0
,
...
...
@@ -105,6 +105,7 @@ class QueryTestCase(unittest.TestCase):
class
DottedPrettyPrinter
(
pprint
.
PrettyPrinter
):
def
format
(
self
,
object
,
context
,
maxlevels
,
level
):
if
isinstance
(
object
,
str
):
if
' '
in
object
:
...
...
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