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
26d64aee
Kaydet (Commit)
26d64aee
authored
Eyl 20, 2010
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
rewrite nocaret test to not rely on a specific SyntaxError
üst
b0b384b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
13 deletions
+4
-13
badsyntax_nocaret.py
Lib/test/badsyntax_nocaret.py
+0
-2
test_traceback.py
Lib/test/test_traceback.py
+4
-11
No files found.
Lib/test/badsyntax_nocaret.py
deleted
100644 → 0
Dosyayı görüntüle @
b0b384b7
def
f
(
x
):
[
x
for
x
in
x
]
=
x
Lib/test/test_traceback.py
Dosyayı görüntüle @
26d64aee
...
...
@@ -5,7 +5,7 @@ from io import StringIO
import
sys
import
unittest
import
re
from
test.support
import
run_unittest
,
is_jython
,
Error
,
captured_output
from
test.support
import
run_unittest
,
Error
,
captured_output
from
test.support
import
TESTFN
,
unlink
import
traceback
...
...
@@ -29,10 +29,6 @@ class SyntaxTracebackCases(unittest.TestCase):
def
syntax_error_with_caret_2
(
self
):
compile
(
"1 +
\n
"
,
"?"
,
"exec"
)
def
syntax_error_without_caret
(
self
):
# XXX why doesn't compile raise the same traceback?
import
test.badsyntax_nocaret
def
syntax_error_bad_indentation
(
self
):
compile
(
"def spam():
\n
print(1)
\n
print(2)"
,
"?"
,
"exec"
)
...
...
@@ -51,13 +47,10 @@ class SyntaxTracebackCases(unittest.TestCase):
self
.
assertTrue
(
err
[
1
]
.
find
(
"+"
)
==
err
[
2
]
.
find
(
"^"
))
# in the right place
def
test_nocaret
(
self
):
if
is_jython
:
# jython adds a caret in this case (why shouldn't it?)
return
err
=
self
.
get_exception_format
(
self
.
syntax_error_without_caret
,
SyntaxError
)
exc
=
SyntaxError
(
"error"
,
(
"x.py"
,
23
,
None
,
"bad syntax"
))
err
=
traceback
.
format_exception_only
(
SyntaxError
,
exc
)
self
.
assertEqual
(
len
(
err
),
3
)
self
.
assert
True
(
err
[
1
]
.
strip
()
==
"[x for x in x] =
x"
)
self
.
assert
Equal
(
err
[
1
]
.
strip
(),
"bad synta
x"
)
def
test_bad_indentation
(
self
):
err
=
self
.
get_exception_format
(
self
.
syntax_error_bad_indentation
,
...
...
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