[Python-checkins] CVS: python/dist/src/Lib/test test_future.py,NONE,1.1 test_future1.py,NONE,1.1 test_future2.py,NONE,1.1 test_future3.py,NONE,1.1 test_future4.py,NONE,1.1 test_future5.py,NONE,1.1 test_future6.py,NONE,1.1 test_future7.py,NONE,1.1 regrtest.py,1.31,1.32
Jeremy Hylton
jhylton@users.sourceforge.net
Wed, 28 Feb 2001 09:48:08 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv19668
Modified Files:
regrtest.py
Added Files:
test_future.py test_future1.py test_future2.py test_future3.py
test_future4.py test_future5.py test_future6.py
test_future7.py
Log Message:
Add regression test for future statements. This adds eight files, but
seven are not tests in their own right; these files are mentioned in
regrtest.
--- NEW FILE: test_future.py ---
# Test various flavors of legal and illegal future statements
from test_support import unload
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)
# The first two tests should work
unload('test_future1')
import test_future1
unload('test_future2')
import test_future2
# The remaining tests should fail
try:
import test_future3
except SyntaxError, msg:
check_error_location(str(msg))
try:
import test_future4
except SyntaxError, msg:
check_error_location(str(msg))
try:
import test_future5
except SyntaxError, msg:
check_error_location(str(msg))
try:
import test_future6
except SyntaxError, msg:
check_error_location(str(msg))
try:
import test_future7
except SyntaxError, msg:
check_error_location(str(msg))
--- NEW FILE: test_future1.py ---
"""This is a test"""
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: test_future2.py ---
"""This is a test"""
from __future__ import nested_scopes; import string
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: test_future3.py ---
"""This is a test"""
from __future__ import nested_scopes
from __future__ import rested_snopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: test_future4.py ---
"""This is a test"""
import __future__
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: test_future5.py ---
"""This is a test"""
from __future__ import nested_scopes
import foo
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: test_future6.py ---
"""This is a test"""
"this isn't a doc string"
from __future__ import nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
--- NEW FILE: test_future7.py ---
"""This is a test"""
from __future__ import nested_scopes; import string; from __future__ import \
nested_scopes
def f(x):
def g(y):
return x + y
return g
print f(2)(4)
Index: regrtest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** regrtest.py 2001/02/23 18:31:40 1.31
--- regrtest.py 2001/02/28 17:48:06 1.32
***************
*** 198,201 ****
--- 198,208 ----
'test_b1',
'test_b2',
+ 'test_future1',
+ 'test_future2',
+ 'test_future3',
+ 'test_future4',
+ 'test_future5',
+ 'test_future6',
+ 'test_future7',
]