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
328f3381
Kaydet (Commit)
328f3381
authored
Ara 13, 2003
tarafından
Neal Norwitz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
üst
378f7b5d
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
101 additions
and
47 deletions
+101
-47
badsyntax_future3.py
Lib/test/badsyntax_future3.py
+1
-1
badsyntax_future4.py
Lib/test/badsyntax_future4.py
+1
-1
badsyntax_future5.py
Lib/test/badsyntax_future5.py
+1
-1
badsyntax_future6.py
Lib/test/badsyntax_future6.py
+1
-1
badsyntax_future7.py
Lib/test/badsyntax_future7.py
+1
-1
badsyntax_future8.py
Lib/test/badsyntax_future8.py
+10
-0
badsyntax_future9.py
Lib/test/badsyntax_future9.py
+10
-0
test_future
Lib/test/output/test_future
+0
-8
test_future.py
Lib/test/test_future.py
+74
-32
test_future1.py
Lib/test/test_future1.py
+1
-1
test_future2.py
Lib/test/test_future2.py
+1
-1
No files found.
Lib/test/badsyntax_future3.py
Dosyayı görüntüle @
328f3381
...
...
@@ -7,4 +7,4 @@ def f(x):
return
x
+
y
return
g
print
f
(
2
)(
4
)
result
=
f
(
2
)(
4
)
Lib/test/badsyntax_future4.py
Dosyayı görüntüle @
328f3381
...
...
@@ -7,4 +7,4 @@ def f(x):
return
x
+
y
return
g
print
f
(
2
)(
4
)
result
=
f
(
2
)(
4
)
Lib/test/badsyntax_future5.py
Dosyayı görüntüle @
328f3381
...
...
@@ -9,4 +9,4 @@ def f(x):
return
x
+
y
return
g
print
f
(
2
)(
4
)
result
=
f
(
2
)(
4
)
Lib/test/badsyntax_future6.py
Dosyayı görüntüle @
328f3381
...
...
@@ -7,4 +7,4 @@ def f(x):
return
x
+
y
return
g
print
f
(
2
)(
4
)
result
=
f
(
2
)(
4
)
Lib/test/badsyntax_future7.py
Dosyayı görüntüle @
328f3381
...
...
@@ -8,4 +8,4 @@ def f(x):
return
x
+
y
return
g
print
f
(
2
)(
4
)
result
=
f
(
2
)(
4
)
Lib/test/badsyntax_future8.py
0 → 100644
Dosyayı görüntüle @
328f3381
"""This is a test"""
from
__future__
import
*
def
f
(
x
):
def
g
(
y
):
return
x
+
y
return
g
print
f
(
2
)(
4
)
Lib/test/badsyntax_future9.py
0 → 100644
Dosyayı görüntüle @
328f3381
"""This is a test"""
from
__future__
import
nested_scopes
,
braces
def
f
(
x
):
def
g
(
y
):
return
x
+
y
return
g
print
f
(
2
)(
4
)
Lib/test/output/test_future
deleted
100644 → 0
Dosyayı görüntüle @
378f7b5d
test_future
6
6
SyntaxError badsyntax_future3 3
SyntaxError badsyntax_future4 3
SyntaxError badsyntax_future5 4
SyntaxError badsyntax_future6 3
SyntaxError badsyntax_future7 3
Lib/test/test_future.py
Dosyayı görüntüle @
328f3381
# Test various flavors of legal and illegal future statements
from
test.test_support
import
unload
import
unittest
from
test
import
test_support
import
re
rx
=
re
.
compile
(
'
\
((
\
S+).py, line (
\
d+)'
)
def
check
_error_location
(
msg
):
mo
=
rx
.
search
(
msg
)
print
"SyntaxError
%
s
%
s"
%
mo
.
group
(
1
,
2
)
def
get
_error_location
(
msg
):
mo
=
rx
.
search
(
str
(
msg
)
)
return
mo
.
group
(
1
,
2
)
# The first two tests should work
class
FutureTest
(
unittest
.
TestCase
):
unload
(
'test_future1'
)
from
test
import
test_future1
def
test_future1
(
self
):
test_support
.
unload
(
'test_future1'
)
from
test
import
test_future1
self
.
assertEqual
(
test_future1
.
result
,
6
)
unload
(
'test_future2'
)
from
test
import
test_future2
def
test_future2
(
self
):
test_support
.
unload
(
'test_future2'
)
from
test
import
test_future2
self
.
assertEqual
(
test_future2
.
result
,
6
)
unload
(
'test_future3'
)
from
test
import
test_future3
def
test_future3
(
self
):
test_support
.
unload
(
'test_future3'
)
from
test
import
test_future3
# The remaining tests should fail
try
:
from
test
import
badsyntax_future3
except
SyntaxError
,
msg
:
check_error_location
(
str
(
msg
))
def
test_badfuture3
(
self
):
try
:
from
test
import
badsyntax_future3
except
SyntaxError
,
msg
:
self
.
assertEqual
(
get_error_location
(
msg
),
(
"badsyntax_future3"
,
'3'
))
else
:
self
.
fail
(
"expected exception didn't occur"
)
try
:
from
test
import
badsyntax_future4
except
SyntaxError
,
msg
:
check_error_location
(
str
(
msg
))
def
test_badfuture4
(
self
):
try
:
from
test
import
badsyntax_future4
except
SyntaxError
,
msg
:
self
.
assertEqual
(
get_error_location
(
msg
),
(
"badsyntax_future4"
,
'3'
))
else
:
self
.
fail
(
"expected exception didn't occur"
)
try
:
from
test
import
badsyntax_future5
except
SyntaxError
,
msg
:
check_error_location
(
str
(
msg
))
def
test_badfuture5
(
self
):
try
:
from
test
import
badsyntax_future5
except
SyntaxError
,
msg
:
self
.
assertEqual
(
get_error_location
(
msg
),
(
"badsyntax_future5"
,
'4'
))
else
:
self
.
fail
(
"expected exception didn't occur"
)
try
:
from
test
import
badsyntax_future6
except
SyntaxError
,
msg
:
check_error_location
(
str
(
msg
))
def
test_badfuture6
(
self
):
try
:
from
test
import
badsyntax_future6
except
SyntaxError
,
msg
:
self
.
assertEqual
(
get_error_location
(
msg
),
(
"badsyntax_future6"
,
'3'
))
else
:
self
.
fail
(
"expected exception didn't occur"
)
try
:
from
test
import
badsyntax_future7
except
SyntaxError
,
msg
:
check_error_location
(
str
(
msg
))
def
test_badfuture7
(
self
):
try
:
from
test
import
badsyntax_future7
except
SyntaxError
,
msg
:
self
.
assertEqual
(
get_error_location
(
msg
),
(
"badsyntax_future7"
,
'3'
))
else
:
self
.
fail
(
"expected exception didn't occur"
)
def
test_badfuture8
(
self
):
try
:
from
test
import
badsyntax_future8
except
SyntaxError
,
msg
:
self
.
assertEqual
(
get_error_location
(
msg
),
(
"badsyntax_future8"
,
'3'
))
else
:
self
.
fail
(
"expected exception didn't occur"
)
def
test_badfuture9
(
self
):
try
:
from
test
import
badsyntax_future9
except
SyntaxError
,
msg
:
self
.
assertEqual
(
get_error_location
(
msg
),
(
"badsyntax_future9"
,
'3'
))
else
:
self
.
fail
(
"expected exception didn't occur"
)
def
test_main
():
test_support
.
run_unittest
(
FutureTest
)
if
__name__
==
"__main__"
:
test_main
()
Lib/test/test_future1.py
Dosyayı görüntüle @
328f3381
...
...
@@ -8,4 +8,4 @@ def f(x):
return
x
+
y
return
g
print
f
(
2
)(
4
)
result
=
f
(
2
)(
4
)
Lib/test/test_future2.py
Dosyayı görüntüle @
328f3381
...
...
@@ -7,4 +7,4 @@ def f(x):
return
x
+
y
return
g
print
f
(
2
)(
4
)
result
=
f
(
2
)(
4
)
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