Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
328f3381
Commit
328f3381
authored
Dec 13, 2003
by
Neal Norwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald
parent
378f7b5d
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
101 additions
and
47 deletions
+101
-47
Lib/test/badsyntax_future3.py
Lib/test/badsyntax_future3.py
+1
-1
Lib/test/badsyntax_future4.py
Lib/test/badsyntax_future4.py
+1
-1
Lib/test/badsyntax_future5.py
Lib/test/badsyntax_future5.py
+1
-1
Lib/test/badsyntax_future6.py
Lib/test/badsyntax_future6.py
+1
-1
Lib/test/badsyntax_future7.py
Lib/test/badsyntax_future7.py
+1
-1
Lib/test/badsyntax_future8.py
Lib/test/badsyntax_future8.py
+10
-0
Lib/test/badsyntax_future9.py
Lib/test/badsyntax_future9.py
+10
-0
Lib/test/output/test_future
Lib/test/output/test_future
+0
-8
Lib/test/test_future.py
Lib/test/test_future.py
+74
-32
Lib/test/test_future1.py
Lib/test/test_future1.py
+1
-1
Lib/test/test_future2.py
Lib/test/test_future2.py
+1
-1
No files found.
Lib/test/badsyntax_future3.py
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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
View file @
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