2001-02-28 13:48:06 -04:00
|
|
|
# Test various flavors of legal and illegal future statements
|
|
|
|
|
2002-07-23 16:04:11 -03:00
|
|
|
from test.test_support import unload
|
2001-02-28 13:48:06 -04:00
|
|
|
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')
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import test_future1
|
2001-02-28 13:48:06 -04:00
|
|
|
|
|
|
|
unload('test_future2')
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import test_future2
|
2001-02-28 13:48:06 -04:00
|
|
|
|
2001-08-20 17:33:42 -03:00
|
|
|
unload('test_future3')
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import test_future3
|
2001-08-20 17:33:42 -03:00
|
|
|
|
2001-02-28 13:48:06 -04:00
|
|
|
# The remaining tests should fail
|
|
|
|
try:
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import badsyntax_future3
|
2001-02-28 13:48:06 -04:00
|
|
|
except SyntaxError, msg:
|
|
|
|
check_error_location(str(msg))
|
|
|
|
|
|
|
|
try:
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import badsyntax_future4
|
2001-02-28 13:48:06 -04:00
|
|
|
except SyntaxError, msg:
|
|
|
|
check_error_location(str(msg))
|
|
|
|
|
|
|
|
try:
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import badsyntax_future5
|
2001-02-28 13:48:06 -04:00
|
|
|
except SyntaxError, msg:
|
|
|
|
check_error_location(str(msg))
|
|
|
|
|
|
|
|
try:
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import badsyntax_future6
|
2001-02-28 13:48:06 -04:00
|
|
|
except SyntaxError, msg:
|
|
|
|
check_error_location(str(msg))
|
|
|
|
|
|
|
|
try:
|
2002-07-30 20:27:12 -03:00
|
|
|
from test import badsyntax_future7
|
2001-02-28 13:48:06 -04:00
|
|
|
except SyntaxError, msg:
|
|
|
|
check_error_location(str(msg))
|