view Lib/test/test_future.py @ 17322:bd110eadc19a legacy-trunk

One-liner critical fix from Jim Fulton: Eric's string-method crusade got the order backwards in a line (for .find()).
author Tim Peters <tim.peters@gmail.com>
date Thu, 05 Apr 2001 22:26:23 +0000
parents b3d504bdd979
children d06bbb8c493a
line wrap: on
line source

# 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))