cpython/Lib/test/test_future.py
Barry Warsaw 04f357cffe Get rid of relative imports in all unittests. Now anything that
imports e.g. test_support must do so using an absolute package name
such as "import test.test_support" or "from test import test_support".

This also updates the README in Lib/test, and gets rid of the
duplicate data dirctory in Lib/test/data (replaced by
Lib/email/test/data).

Now Tim and Jack can have at it. :)
2002-07-23 19:04:11 +00:00

47 lines
932 B
Python

# Test various flavors of legal and illegal future statements
from test.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
unload('test_future3')
import test_future3
# The remaining tests should fail
try:
import badsyntax_future3
except SyntaxError, msg:
check_error_location(str(msg))
try:
import badsyntax_future4
except SyntaxError, msg:
check_error_location(str(msg))
try:
import badsyntax_future5
except SyntaxError, msg:
check_error_location(str(msg))
try:
import badsyntax_future6
except SyntaxError, msg:
check_error_location(str(msg))
try:
import badsyntax_future7
except SyntaxError, msg:
check_error_location(str(msg))