blob: 764584c10a0888674b0ae7e832c1dbe6a1855fa1 [file] [log] [blame]
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +00001# Test various flavors of legal and illegal future statements
2
3from test_support import unload
4import re
5
6rx = re.compile('\((\S+).py, line (\d+)')
7
8def check_error_location(msg):
9 mo = rx.search(msg)
10 print "SyntaxError %s %s" % mo.group(1, 2)
11
12# The first two tests should work
13
14unload('test_future1')
15import test_future1
16
17unload('test_future2')
18import test_future2
19
Jeremy Hylton8471a352001-08-20 20:33:42 +000020unload('test_future3')
21import test_future3
22
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000023# The remaining tests should fail
24try:
Jeremy Hylton30906942001-04-18 01:19:28 +000025 import badsyntax_future3
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000026except SyntaxError, msg:
27 check_error_location(str(msg))
28
29try:
Jeremy Hylton30906942001-04-18 01:19:28 +000030 import badsyntax_future4
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000031except SyntaxError, msg:
32 check_error_location(str(msg))
33
34try:
Jeremy Hylton30906942001-04-18 01:19:28 +000035 import badsyntax_future5
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000036except SyntaxError, msg:
37 check_error_location(str(msg))
38
39try:
Jeremy Hylton30906942001-04-18 01:19:28 +000040 import badsyntax_future6
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000041except SyntaxError, msg:
42 check_error_location(str(msg))
43
44try:
Jeremy Hylton30906942001-04-18 01:19:28 +000045 import badsyntax_future7
Jeremy Hylton62e2c7e2001-02-28 17:48:06 +000046except SyntaxError, msg:
47 check_error_location(str(msg))